Index: trunk/phase3/tests/LocalFileTest.php |
— | — | @@ -2,11 +2,14 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * These tests should work regardless of $wgCapitalLinks |
6 | | - * @group Broken |
7 | 6 | */ |
8 | 7 | |
| 8 | +require 'Namespace.php'; |
| 9 | + |
9 | 10 | class LocalFileTest extends PHPUnit_Framework_TestCase { |
10 | 11 | function setUp() { |
| 12 | + global $wgContLang; |
| 13 | + $wgContLang = new Language; |
11 | 14 | $info = array( |
12 | 15 | 'name' => 'test', |
13 | 16 | 'directory' => '/testdir', |
— | — | @@ -22,6 +25,11 @@ |
23 | 26 | $this->file_lc = $this->repo_lc->newFile( 'test!' ); |
24 | 27 | } |
25 | 28 | |
| 29 | + function tearDown() { |
| 30 | + global $wgContLang; |
| 31 | + unset($wgContLang); |
| 32 | + } |
| 33 | + |
26 | 34 | function testGetHashPath() { |
27 | 35 | $this->assertEquals( '', $this->file_hl0->getHashPath() ); |
28 | 36 | $this->assertEquals( 'a/a2/', $this->file_hl2->getHashPath() ); |
— | — | @@ -76,10 +84,10 @@ |
77 | 85 | } |
78 | 86 | |
79 | 87 | function testGetThumbVirtualUrl() { |
80 | | - $this->assertEquals( 'mwrepo://test/public/thumb/Test%21', $this->file_hl0->getThumbVirtualUrl() ); |
81 | | - $this->assertEquals( 'mwrepo://test/public/thumb/a/a2/Test%21', $this->file_hl2->getThumbVirtualUrl() ); |
82 | | - $this->assertEquals( 'mwrepo://test/public/thumb/Test%21/%21', $this->file_hl0->getThumbVirtualUrl( '!' ) ); |
83 | | - $this->assertEquals( 'mwrepo://test/public/thumb/a/a2/Test%21/%21', $this->file_hl2->getThumbVirtualUrl( '!' ) ); |
| 88 | + $this->assertEquals( 'mwrepo://test/thumb/Test%21', $this->file_hl0->getThumbVirtualUrl() ); |
| 89 | + $this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21', $this->file_hl2->getThumbVirtualUrl() ); |
| 90 | + $this->assertEquals( 'mwrepo://test/thumb/Test%21/%21', $this->file_hl0->getThumbVirtualUrl( '!' ) ); |
| 91 | + $this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21/%21', $this->file_hl2->getThumbVirtualUrl( '!' ) ); |
84 | 92 | } |
85 | 93 | |
86 | 94 | function testGetUrl() { |
Index: trunk/phase3/tests/SearchEngineTest.php |
— | — | @@ -3,7 +3,6 @@ |
4 | 4 | require_once 'MediaWiki_TestCase.php'; |
5 | 5 | |
6 | 6 | /** @todo document |
7 | | - * @group Broken |
8 | 7 | */ |
9 | 8 | |
10 | 9 | class SearchEngineTest extends MediaWiki_TestCase { |
— | — | @@ -82,55 +81,55 @@ |
83 | 82 | } |
84 | 83 | |
85 | 84 | function testTextSearch() { |
86 | | - $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." ); |
87 | | - if( !is_null( $this->db ) ) { |
88 | | - $this->assertEquals( |
89 | | - array( 'Smithee' ), |
90 | | - $this->fetchIds( $this->search->searchText( 'smithee' ) ), |
91 | | - "Plain search failed" ); |
| 85 | + if( is_null( $this->db ) ) { |
| 86 | + $this->markTestIncomplete( "Can't find a database to test with." ); |
92 | 87 | } |
| 88 | + $this->assertEquals( |
| 89 | + array( 'Smithee' ), |
| 90 | + $this->fetchIds( $this->search->searchText( 'smithee' ) ), |
| 91 | + "Plain search failed" ); |
93 | 92 | } |
94 | 93 | |
95 | 94 | function testTextPowerSearch() { |
96 | | - $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." ); |
97 | | - if( !is_null( $this->db ) ) { |
98 | | - $this->search->setNamespaces( array( 0, 1, 4 ) ); |
99 | | - $this->assertEquals( |
100 | | - array( |
101 | | - 'Smithee', |
102 | | - 'Talk:Main Page', |
103 | | - ), |
104 | | - $this->fetchIds( $this->search->searchText( 'smithee' ) ), |
105 | | - "Power search failed" ); |
| 95 | + if( is_null( $this->db ) ) { |
| 96 | + $this->markTestIncomplete( "Can't find a database to test with." ); |
106 | 97 | } |
| 98 | + $this->search->setNamespaces( array( 0, 1, 4 ) ); |
| 99 | + $this->assertEquals( |
| 100 | + array( |
| 101 | + 'Smithee', |
| 102 | + 'Talk:Main Page', |
| 103 | + ), |
| 104 | + $this->fetchIds( $this->search->searchText( 'smithee' ) ), |
| 105 | + "Power search failed" ); |
107 | 106 | } |
108 | 107 | |
109 | 108 | function testTitleSearch() { |
110 | | - $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." ); |
111 | | - if( !is_null( $this->db ) ) { |
112 | | - $this->assertEquals( |
113 | | - array( |
114 | | - 'Alan Smithee', |
115 | | - 'Smithee', |
116 | | - ), |
117 | | - $this->fetchIds( $this->search->searchTitle( 'smithee' ) ), |
118 | | - "Title search failed" ); |
| 109 | + if( is_null( $this->db ) ) { |
| 110 | + $this->markTestIncomplete( "Can't find a database to test with." ); |
119 | 111 | } |
| 112 | + $this->assertEquals( |
| 113 | + array( |
| 114 | + 'Alan Smithee', |
| 115 | + 'Smithee', |
| 116 | + ), |
| 117 | + $this->fetchIds( $this->search->searchTitle( 'smithee' ) ), |
| 118 | + "Title search failed" ); |
120 | 119 | } |
121 | 120 | |
122 | 121 | function testTextTitlePowerSearch() { |
123 | | - $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." ); |
124 | | - if( !is_null( $this->db ) ) { |
125 | | - $this->search->setNamespaces( array( 0, 1, 4 ) ); |
126 | | - $this->assertEquals( |
127 | | - array( |
128 | | - 'Alan Smithee', |
129 | | - 'Smithee', |
130 | | - 'Talk:Smithee', |
131 | | - ), |
132 | | - $this->fetchIds( $this->search->searchTitle( 'smithee' ) ), |
133 | | - "Title power search failed" ); |
| 122 | + if( is_null( $this->db ) ) { |
| 123 | + $this->markTestIncomplete( "Can't find a database to test with." ); |
134 | 124 | } |
| 125 | + $this->search->setNamespaces( array( 0, 1, 4 ) ); |
| 126 | + $this->assertEquals( |
| 127 | + array( |
| 128 | + 'Alan Smithee', |
| 129 | + 'Smithee', |
| 130 | + 'Talk:Smithee', |
| 131 | + ), |
| 132 | + $this->fetchIds( $this->search->searchTitle( 'smithee' ) ), |
| 133 | + "Title power search failed" ); |
135 | 134 | } |
136 | 135 | |
137 | 136 | } |
Index: trunk/phase3/tests/MediaWiki_TestCase.php |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | protected function buildTestDatabase( $tables ) { |
10 | 10 | global $testOptions, $wgDBprefix, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname; |
11 | 11 | $wgDBprefix = 'parsertest_'; |
| 12 | + $this->markTestIncomplete("This test requires DB admin user credentials."); |
12 | 13 | $db = new DatabaseMysql( |
13 | 14 | $wgDBserver, |
14 | 15 | $wgDBadminuser, |
Index: trunk/phase3/tests/ImageFunctionsTest.php |
— | — | @@ -1,5 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +require 'ImageFunctions.php'; |
| 5 | + |
4 | 6 | class ImageFunctionsTest extends PHPUnit_Framework_TestCase { |
5 | 7 | function testFitBoxWidth() { |
6 | 8 | $vals = array( |
Index: trunk/phase3/tests/LanguageConverterTest.php |
— | — | @@ -1,16 +1,22 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +require 'ProxyTools.php'; |
| 5 | + |
4 | 6 | class LanguageConverterTest extends PHPUnit_Framework_TestCase { |
5 | 7 | protected $lang = null; |
6 | | - protected $lc = null; |
| 8 | + protected $lc = null; |
7 | 9 | |
8 | 10 | function setUp() { |
| 11 | + global $wgMemc; |
| 12 | + $wgMemc = new FakeMemCachedClient; |
9 | 13 | $this->lang = new LanguageTest(); |
10 | 14 | $this->lc = new TestConverter( $this->lang, 'tg', |
11 | 15 | array( 'tg', 'tg-latn' ) ); |
12 | 16 | } |
13 | 17 | |
14 | 18 | function tearDown() { |
| 19 | + global $wgMemc; |
| 20 | + unset($wgMemc); |
15 | 21 | unset($this->lc); |
16 | 22 | unset($this->lang); |
17 | 23 | } |
Index: trunk/phase3/tests/bootstrap.php |
— | — | @@ -1,19 +1,16 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -global $wgCommandLineMode, $IP, $wgMemc; |
| 4 | +global $wgCommandLineMode, $IP; |
5 | 5 | $wgCommandLineMode = true; |
| 6 | +$IP = dirname( dirname( __FILE__ ) ); |
6 | 7 | define('MEDIAWIKI', 1); |
| 8 | +ini_set( 'include_path', "$IP:" .ini_get( 'include_path' ) ); |
7 | 9 | |
8 | | -require dirname( dirname( __FILE__ ) ).implode( DIRECTORY_SEPARATOR, array( "", "includes", "Defines.php" ) ); |
| 10 | +require ( "$IP/includes/Defines.php" ); |
| 11 | +require ( "$IP/includes/DefaultSettings.php" ); |
| 12 | +require ( "$IP/LocalSettings.php" ); |
9 | 13 | |
10 | | -require dirname( dirname( __FILE__ ) ).DIRECTORY_SEPARATOR."LocalSettings.php"; |
11 | | - |
12 | | -require "ProfilerStub.php"; |
| 14 | +require 'ProfilerStub.php'; |
13 | 15 | require 'GlobalFunctions.php'; |
14 | 16 | require 'Hooks.php'; |
15 | | -require "AutoLoader.php"; |
16 | | -require 'ProxyTools.php'; |
17 | | -require 'ObjectCache.php'; |
18 | | -require 'ImageFunctions.php'; |
19 | | - |
20 | | -$wgMemc =& wfGetMainCache(); |
| 17 | +require 'AutoLoader.php'; |
Index: trunk/phase3/tests/SearchMySQL4Test.php |
— | — | @@ -1,10 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | require_once( 'SearchEngineTest.php' ); |
4 | 4 | |
5 | | -/** |
6 | | - * @group Broken |
7 | | - */ |
8 | | - |
9 | 5 | class SearchMySQL4Test extends SearchEngineTest { |
10 | 6 | var $db; |
11 | 7 | |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -80,6 +80,7 @@ |
81 | 81 | 'ExternalUser_vB' => 'includes/extauth/vB.php', |
82 | 82 | 'FatalError' => 'includes/Exception.php', |
83 | 83 | 'FakeTitle' => 'includes/FakeTitle.php', |
| 84 | + 'FakeMemCachedClient' => 'includes/ObjectCache.php', |
84 | 85 | 'FauxRequest' => 'includes/WebRequest.php', |
85 | 86 | 'FeedItem' => 'includes/Feed.php', |
86 | 87 | 'FeedUtils' => 'includes/FeedUtils.php', |
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | NS_CATEGORY_TALK => 'Category_talk', |
30 | 30 | ); |
31 | 31 | |
32 | | -if( is_array( $wgExtraNamespaces ) ) { |
| 32 | +if( isset( $wgExtraNamespaces ) && is_array( $wgExtraNamespaces ) ) { |
33 | 33 | $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces; |
34 | 34 | } |
35 | 35 | |