Index: trunk/phase3/tests/DatabaseTest.php |
— | — | @@ -8,9 +8,11 @@ |
9 | 9 | } |
10 | 10 | |
11 | 11 | function testAddQuotesNull() { |
12 | | - $this->assertEquals( |
13 | | - 'NULL', |
14 | | - $this->db->addQuotes( null ) ); |
| 12 | + $check = "NULL"; |
| 13 | + if ( $this->db instanceOf DatabaseSqlite ) { |
| 14 | + $check = "''"; |
| 15 | + } |
| 16 | + $this->assertEquals( $check, $this->db->addQuotes( null ) ); |
15 | 17 | } |
16 | 18 | |
17 | 19 | function testAddQuotesInt() { |
— | — | @@ -35,8 +37,12 @@ |
36 | 38 | } |
37 | 39 | |
38 | 40 | function testAddQuotesStringQuote() { |
| 41 | + $check = "'string''s cause trouble'"; |
| 42 | + if ( $this->db instanceOf DatabaseMysql ) { |
| 43 | + $check = "'string\'s cause trouble'"; |
| 44 | + } |
39 | 45 | $this->assertEquals( |
40 | | - "'string\'s cause trouble'", |
| 46 | + $check, |
41 | 47 | $this->db->addQuotes( "string's cause trouble" ) ); |
42 | 48 | } |
43 | 49 | |
— | — | @@ -52,18 +58,24 @@ |
53 | 59 | $sql = $this->db->fillPrepared( |
54 | 60 | 'SELECT * FROM cur WHERE cur_namespace=? AND cur_title=?', |
55 | 61 | array( 4, "Snicker's_paradox" ) ); |
56 | | - $this->assertEquals( |
57 | | - "SELECT * FROM cur WHERE cur_namespace='4' AND cur_title='Snicker\'s_paradox'", |
58 | | - $sql); |
| 62 | + |
| 63 | + $check = "SELECT * FROM cur WHERE cur_namespace='4' AND cur_title='Snicker''s_paradox'"; |
| 64 | + if ( $this->db instanceOf DatabaseMysql ) { |
| 65 | + $check = "SELECT * FROM cur WHERE cur_namespace='4' AND cur_title='Snicker\'s_paradox'"; |
| 66 | + } |
| 67 | + $this->assertEquals( $check, $sql ); |
59 | 68 | } |
60 | 69 | |
61 | 70 | function testFillPreparedBang() { |
62 | 71 | $sql = $this->db->fillPrepared( |
63 | 72 | 'SELECT user_id FROM ! WHERE user_name=?', |
64 | 73 | array( '"user"', "Slash's Dot" ) ); |
65 | | - $this->assertEquals( |
66 | | - "SELECT user_id FROM \"user\" WHERE user_name='Slash\'s Dot'", |
67 | | - $sql); |
| 74 | + |
| 75 | + $check = "SELECT user_id FROM \"user\" WHERE user_name='Slash''s Dot'"; |
| 76 | + if ( $this->db instanceOf DatabaseMysql ) { |
| 77 | + $check = "SELECT user_id FROM \"user\" WHERE user_name='Slash\'s Dot'"; |
| 78 | + } |
| 79 | + $this->assertEquals( $check, $sql ); |
68 | 80 | } |
69 | 81 | |
70 | 82 | function testFillPreparedRaw() { |
Index: trunk/phase3/tests/bootstrap.php |
— | — | @@ -4,9 +4,10 @@ |
5 | 5 | $wgCommandLineMode = true; |
6 | 6 | define('MEDIAWIKI', 1); |
7 | 7 | |
8 | | -require dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."LocalSettings.php"; |
| 8 | +require dirname( dirname( __FILE__ ) ).implode( DIRECTORY_SEPARATOR, array( "", "includes", "Defines.php" ) ); |
9 | 9 | |
10 | | -require "Defines.php"; |
| 10 | +require dirname( dirname( __FILE__ ) ).DIRECTORY_SEPARATOR."LocalSettings.php"; |
| 11 | + |
11 | 12 | require "ProfilerStub.php"; |
12 | 13 | require 'GlobalFunctions.php'; |
13 | 14 | require 'Hooks.php'; |