Index: trunk/phase3/maintenance/tests/SearchEngineTest.php |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | } |
47 | 47 | |
48 | 48 | function fetchIds( $results ) { |
| 49 | + if ( $this->db->getType() !== 'mysql' ) $this->markTestSkipped( "MySQL only" ); |
49 | 50 | $matches = array(); |
50 | 51 | while ( $row = $results->next() ) { |
51 | 52 | $matches[] = $row->getTitle()->getPrefixedText(); |
— | — | @@ -130,8 +131,8 @@ |
131 | 132 | "Search for normalized from Full-width Lower" ); |
132 | 133 | } |
133 | 134 | |
134 | | - function testTextSearch() { |
135 | | - $this->assertEquals( |
| 135 | + function testTextSearch() { |
| 136 | + $this->assertEquals( |
136 | 137 | array( 'Smithee' ), |
137 | 138 | $this->fetchIds( $this->search->searchText( 'smithee' ) ), |
138 | 139 | "Plain search failed" ); |
Index: trunk/phase3/maintenance/tests/UploadFromUrlTestSuite.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | $wgLocalFileRepo = array( |
32 | 32 | 'class' => 'LocalRepo', |
33 | 33 | 'name' => 'local', |
34 | | - 'directory' => 'test-repo', |
| 34 | + 'directory' => wfTempDir().'/test-repo', |
35 | 35 | 'url' => 'http://example.com/images', |
36 | 36 | 'hashLevels' => 2, |
37 | 37 | 'transformVia404' => false, |
Index: trunk/phase3/maintenance/tests/bootstrap.php |
— | — | @@ -14,6 +14,10 @@ |
15 | 15 | require_once( "$IP/maintenance/commandLine.inc" ); |
16 | 16 | $wgLocaltimezone = 'UTC'; |
17 | 17 | |
| 18 | +/* Tests were failing with sqlite */ |
| 19 | +global $wgCaches; |
| 20 | +$wgCaches[CACHE_DB] = false; |
| 21 | + |
18 | 22 | if ( !version_compare( PHPUnit_Runner_Version::id(), "3.4.1", ">" ) ) { |
19 | 23 | echo <<<EOF |
20 | 24 | ************************************************************ |
Index: trunk/phase3/maintenance/tests/TitlePermissionTest.php |
— | — | @@ -66,6 +66,9 @@ |
67 | 67 | } |
68 | 68 | |
69 | 69 | function testQuickPermissions() { |
| 70 | + global $wgContLang; |
| 71 | + $prefix = $wgContLang->getNsText( NS_PROJECT ); |
| 72 | + |
70 | 73 | $this->setUser( 'anon' ); |
71 | 74 | $this->setTitle( NS_TALK ); |
72 | 75 | $this->setUserPerm( "createtalk" ); |
— | — | @@ -251,10 +254,10 @@ |
252 | 255 | $this->assertEquals( array( ), $res ); |
253 | 256 | |
254 | 257 | $this->setUser( 'anon' ); |
255 | | - $check = array( 'edit' => array( array( array( 'badaccess-groups', "*, [[Mw:Users|Users]]", 2 ) ), |
| 258 | + $check = array( 'edit' => array( array( array( 'badaccess-groups', "*, [[$prefix:Users|Users]]", 2 ) ), |
256 | 259 | array( array( 'badaccess-group0' ) ), |
257 | 260 | array( ), true ), |
258 | | - 'protect' => array( array( array( 'badaccess-groups', "[[Mw:Administrators|Administrators]]", 1 ), array( 'protect-cantedit' ) ), |
| 261 | + 'protect' => array( array( array( 'badaccess-groups', "[[$prefix:Administrators|Administrators]]", 1 ), array( 'protect-cantedit' ) ), |
259 | 262 | array( array( 'badaccess-group0' ), array( 'protect-cantedit' ) ), |
260 | 263 | array( array( 'protect-cantedit' ) ), false ), |
261 | 264 | '' => array( array( ), array( ), array( ), true ) ); |
— | — | @@ -316,14 +319,15 @@ |
317 | 320 | function testPermissionHooks() { } |
318 | 321 | function testSpecialsAndNSPermissions() { |
319 | 322 | $this->setUser( self::$userName ); |
320 | | - global $wgUser; |
| 323 | + global $wgUser, $wgContLang; |
321 | 324 | $wgUser = self::$user; |
| 325 | + $prefix = $wgContLang->getNsText( NS_PROJECT ); |
322 | 326 | |
323 | 327 | $this->setTitle( NS_SPECIAL ); |
324 | 328 | |
325 | 329 | $this->assertEquals( array( array( 'badaccess-group0' ), array( 'ns-specialprotected' ) ), |
326 | 330 | self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
327 | | - $this->assertEquals( array( array( 'badaccess-groups', '*, [[Mw:Administrators|Administrators]]', 2 ) ), |
| 331 | + $this->assertEquals( array( array( 'badaccess-groups', "*, [[$prefix:Administrators|Administrators]]", 2 ) ), |
328 | 332 | self::$title->getUserPermissionsErrors( 'createaccount', self::$user ) ); |
329 | 333 | $this->assertEquals( array( array( 'badaccess-group0' ) ), |
330 | 334 | self::$title->getUserPermissionsErrors( 'execute', self::$user ) ); |
— | — | @@ -421,7 +425,10 @@ |
422 | 426 | } |
423 | 427 | |
424 | 428 | function testPageRestrictions() { |
425 | | - global $wgUser; |
| 429 | + global $wgUser, $wgContLang; |
| 430 | + |
| 431 | + $prefix = $wgContLang->getNsText( NS_PROJECT ); |
| 432 | + |
426 | 433 | $wgUser = self::$user; |
427 | 434 | $this->setTitle( NS_MAIN ); |
428 | 435 | self::$title->mRestrictionsLoaded = true; |
— | — | @@ -455,7 +462,7 @@ |
456 | 463 | array( 'protectedpagetext', 'protect' ) ), |
457 | 464 | self::$title->getUserPermissionsErrors( 'bogus', |
458 | 465 | self::$user ) ); |
459 | | - $this->assertEquals( array( array( 'badaccess-groups', '*, [[Mw:Users|Users]]', 2 ), |
| 466 | + $this->assertEquals( array( array( 'badaccess-groups', "*, [[$prefix:Users|Users]]", 2 ), |
460 | 467 | array( 'protectedpagetext', 'bogus' ), |
461 | 468 | array( 'protectedpagetext', 'protect' ), |
462 | 469 | array( 'protectedpagetext', 'protect' ) ), |
Index: trunk/phase3/maintenance/tests/UploadFromUrlTest.php |
— | — | @@ -18,14 +18,6 @@ |
19 | 19 | $wgEnableUploads = true; |
20 | 20 | $wgAllowCopyUploads = true; |
21 | 21 | parent::setup(); |
22 | | - $wgLocalFileRepo = array( |
23 | | - 'class' => 'LocalRepo', |
24 | | - 'name' => 'local', |
25 | | - 'directory' => 'test-repo', |
26 | | - 'url' => 'http://example.com/images', |
27 | | - 'hashLevels' => 2, |
28 | | - 'transformVia404' => false, |
29 | | - ); |
30 | 22 | |
31 | 23 | ini_set( 'log_errors', 1 ); |
32 | 24 | ini_set( 'error_reporting', 1 ); |
— | — | @@ -174,6 +166,7 @@ |
175 | 167 | $this->assertEquals( 'UploadFromUrlJob', get_class( $job ) ); |
176 | 168 | |
177 | 169 | $status = $job->run(); |
| 170 | + |
178 | 171 | $this->assertTrue( $status->isOk() ); |
179 | 172 | |
180 | 173 | return $data; |
Index: trunk/phase3/maintenance/tests/CdbTest.php |
— | — | @@ -13,9 +13,14 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function testCdb() { |
17 | | - $w1 = new CdbWriter_PHP( 'php.cdb' ); |
18 | | - $w2 = new CdbWriter_DBA( 'dba.cdb' ); |
| 17 | + $dir = wfTempDir(); |
| 18 | + if ( !is_writable( $dir ) ) { |
| 19 | + $this->markTestSkipped( "Temp dir isn't writable" ); |
| 20 | + } |
19 | 21 | |
| 22 | + $w1 = new CdbWriter_PHP( "$dir/php.cdb" ); |
| 23 | + $w2 = new CdbWriter_DBA( "$dir/dba.cdb" ); |
| 24 | + |
20 | 25 | $data = array(); |
21 | 26 | for ( $i = 0; $i < 1000; $i++ ) { |
22 | 27 | $key = $this->randomString(); |
— | — | @@ -32,13 +37,13 @@ |
33 | 38 | $w2->close(); |
34 | 39 | |
35 | 40 | $this->assertEquals( |
36 | | - md5_file( 'dba.cdb' ), |
37 | | - md5_file( 'php.cdb' ), |
| 41 | + md5_file( "$dir/dba.cdb" ), |
| 42 | + md5_file( "$dir/php.cdb" ), |
38 | 43 | 'same hash' |
39 | 44 | ); |
40 | 45 | |
41 | | - $r1 = new CdbReader_PHP( 'php.cdb' ); |
42 | | - $r2 = new CdbReader_DBA( 'dba.cdb' ); |
| 46 | + $r1 = new CdbReader_PHP( "$dir/php.cdb" ); |
| 47 | + $r2 = new CdbReader_DBA( "$dir/dba.cdb" ); |
43 | 48 | |
44 | 49 | foreach ( $data as $key => $value ) { |
45 | 50 | if ( $key === '' ) { |
— | — | @@ -56,8 +61,8 @@ |
57 | 62 | $this->cdbAssert( "DBA error", $key, $v2, $value ); |
58 | 63 | } |
59 | 64 | |
60 | | - unlink( 'dba.cdb' ); |
61 | | - unlink( 'php.cdb' ); |
| 65 | + unlink( "$dir/dba.cdb" ); |
| 66 | + unlink( "$dir/php.cdb" ); |
62 | 67 | } |
63 | 68 | |
64 | 69 | private function randomString() { |