3 require_once( 'PHPUnit.php' );
4 require_once( '../includes/Defines.php' );
5 require_once( '../includes/Database.php' );
6 require_once( '../includes/GlobalFunctions.php' );
8 class DatabaseTest
extends PHPUnit_TestCase
{
11 function DatabaseTest( $name ) {
12 $this->PHPUnit_TestCase( $name );
16 $this->db
=& new Database();
23 function testFillPreparedEmpty() {
24 $sql = $this->db
->fillPrepared(
25 'SELECT * FROM interwiki', array() );
27 "SELECT * FROM interwiki",
31 function testFillPreparedQuestion() {
32 $sql = $this->db
->fillPrepared(
33 'SELECT * FROM cur WHERE cur_namespace=? AND cur_title=?',
34 array( 4, "Snicker's_paradox" ) );
36 "SELECT * FROM cur WHERE cur_namespace='4' AND cur_title='Snicker\'s_paradox'",
40 function testFillPreparedBang() {
41 $sql = $this->db
->fillPrepared(
42 'SELECT user_id FROM ! WHERE user_name=?',
43 array( '"user"', "Slash's Dot" ) );
45 "SELECT user_id FROM \"user\" WHERE user_name='Slash\'s Dot'",
49 function testFillPreparedRaw() {
50 $sql = $this->db
->fillPrepared(
51 "SELECT * FROM cur WHERE cur_title='This_\\&_that,_WTF\\?\\!'",
52 array( '"user"', "Slash's Dot" ) );
54 "SELECT * FROM cur WHERE cur_title='This_&_that,_WTF?!'",