| Index: trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php |
| — | — | @@ -12,16 +12,10 @@ |
| 13 | 13 | */ |
| 14 | 14 | class MWNamespaceTest extends MediaWikiTestCase { |
| 15 | 15 | /** |
| 16 | | - * @var MWNamespace |
| 17 | | - */ |
| 18 | | - protected $object; |
| 19 | | - |
| 20 | | - /** |
| 21 | 16 | * Sets up the fixture, for example, opens a network connection. |
| 22 | 17 | * This method is called before a test is executed. |
| 23 | 18 | */ |
| 24 | 19 | protected function setUp() { |
| 25 | | - $this->object = new MWNamespace; |
| 26 | 20 | } |
| 27 | 21 | |
| 28 | 22 | /** |
| — | — | @@ -87,7 +81,7 @@ |
| 88 | 82 | * the function testGetTalkExceptions() |
| 89 | 83 | */ |
| 90 | 84 | public function testGetTalk() { |
| 91 | | - $this->assertEquals( MWNamespace::getTalk( NS_MAIN), NS_TALK ); |
| | 85 | + $this->assertEquals( NS_TALK, MWNamespace::getTalk( NS_MAIN ) ); |
| 92 | 86 | } |
| 93 | 87 | |
| 94 | 88 | /** |
| — | — | @@ -101,13 +95,13 @@ |
| 102 | 96 | } |
| 103 | 97 | |
| 104 | 98 | /** |
| 105 | | - * Regular getAssociated() calls |
| | 99 | + * Regular getAssociated() calls |
| 106 | 100 | * Namespaces without an associated page (NS_MEDIA, NS_SPECIAL) are tested in |
| 107 | 101 | * the function testGetAssociatedExceptions() |
| 108 | 102 | */ |
| 109 | 103 | public function testGetAssociated() { |
| 110 | | - $this->assertEquals( MWNamespace::getAssociated( NS_MAIN ), NS_TALK ); |
| 111 | | - $this->assertEquals( MWNamespace::getAssociated( NS_TALK ), NS_MAIN ); |
| | 104 | + $this->assertEquals( NS_TALK, MWNamespace::getAssociated( NS_MAIN ) ); |
| | 105 | + $this->assertEquals( NS_MAIN, MWNamespace::getAssociated( NS_TALK ) ); |
| 112 | 106 | |
| 113 | 107 | } |
| 114 | 108 | |
| — | — | @@ -131,11 +125,11 @@ |
| 132 | 126 | */ |
| 133 | 127 | public function testGetSubject() { |
| 134 | 128 | // Special namespaces are their own subjects |
| 135 | | - $this->assertEquals( MWNamespace::getSubject( NS_MEDIA ), NS_MEDIA ); |
| 136 | | - $this->assertEquals( MWNamespace::getSubject( NS_SPECIAL ), NS_SPECIAL ); |
| | 129 | + $this->assertEquals( NS_MEDIA, MWNamespace::getSubject( NS_MEDIA ) ); |
| | 130 | + $this->assertEquals( NS_SPECIAL, MWNamespace::getSubject( NS_SPECIAL ) ); |
| 137 | 131 | |
| 138 | | - $this->assertEquals( MWNamespace::getSubject( NS_TALK ), NS_MAIN ); |
| 139 | | - $this->assertEquals( MWNamespace::getSubject( NS_USER_TALK ), NS_USER ); |
| | 132 | + $this->assertEquals( NS_MAIN, MWNamespace::getSubject( NS_TALK ) ); |
| | 133 | + $this->assertEquals( NS_USER, MWNamespace::getSubject( NS_USER_TALK ) ); |
| 140 | 134 | } |
| 141 | 135 | |
| 142 | 136 | /** |
| — | — | @@ -230,7 +224,7 @@ |
| 231 | 225 | * Similar to testIsContent() but alters the $wgContentNamespaces |
| 232 | 226 | * global variable. |
| 233 | 227 | */ |
| 234 | | - public function testIsContentWithAdditionsInWgContentNamespaces() { |
| | 228 | + public function testIsContentWithAdditionsInWgContentNamespaces() { |
| 235 | 229 | // NS_MAIN is a content namespace per DefaultSettings.php |
| 236 | 230 | // and per function definition. |
| 237 | 231 | $this->assertTrue( MWNamespace::isContent( NS_MAIN ) ); |
| — | — | @@ -306,8 +300,8 @@ |
| 307 | 301 | */ |
| 308 | 302 | public function testGetContentNamespaces() { |
| 309 | 303 | $this->assertEquals( |
| | 304 | + array( NS_MAIN ), |
| 310 | 305 | MWNamespace::getcontentNamespaces(), |
| 311 | | - array( NS_MAIN), |
| 312 | 306 | '$wgContentNamespaces is an array with only NS_MAIN by default' |
| 313 | 307 | ); |
| 314 | 308 | |
| — | — | @@ -315,37 +309,37 @@ |
| 316 | 310 | |
| 317 | 311 | # test !is_array( $wgcontentNamespaces ) |
| 318 | 312 | $wgContentNamespaces = ''; |
| 319 | | - $this->assertEquals( MWNamespace::getcontentNamespaces(), NS_MAIN ); |
| | 313 | + $this->assertEquals( NS_MAIN, MWNamespace::getcontentNamespaces() ); |
| 320 | 314 | $wgContentNamespaces = false; |
| 321 | | - $this->assertEquals( MWNamespace::getcontentNamespaces(), NS_MAIN ); |
| | 315 | + $this->assertEquals( NS_MAIN, MWNamespace::getcontentNamespaces() ); |
| 322 | 316 | $wgContentNamespaces = null; |
| 323 | | - $this->assertEquals( MWNamespace::getcontentNamespaces(), NS_MAIN ); |
| | 317 | + $this->assertEquals( NS_MAIN, MWNamespace::getcontentNamespaces() ); |
| 324 | 318 | $wgContentNamespaces = 5; |
| 325 | | - $this->assertEquals( MWNamespace::getcontentNamespaces(), NS_MAIN ); |
| | 319 | + $this->assertEquals( NS_MAIN, MWNamespace::getcontentNamespaces() ); |
| 326 | 320 | |
| 327 | | - # test $wgContentNamespaces === array() |
| | 321 | + # test $wgContentNamespaces === array() |
| 328 | 322 | $wgContentNamespaces = array(); |
| 329 | | - $this->assertEquals( MWNamespace::getcontentNamespaces(), NS_MAIN ); |
| | 323 | + $this->assertEquals( NS_MAIN, MWNamespace::getcontentNamespaces() ); |
| 330 | 324 | |
| 331 | 325 | # test !in_array( NS_MAIN, $wgContentNamespaces ) |
| 332 | 326 | $wgContentNamespaces = array( NS_USER, NS_CATEGORY ); |
| 333 | 327 | $this->assertEquals( |
| 334 | | - MWNamespace::getcontentNamespaces(), |
| 335 | 328 | array( NS_MAIN, NS_USER, NS_CATEGORY ), |
| | 329 | + MWNamespace::getcontentNamespaces(), |
| 336 | 330 | 'NS_MAIN is forced in wgContentNamespaces even if unwanted' |
| 337 | 331 | ); |
| 338 | 332 | |
| 339 | 333 | # test other cases, return $wgcontentNamespaces as is |
| 340 | 334 | $wgContentNamespaces = array( NS_MAIN ); |
| 341 | 335 | $this->assertEquals( |
| 342 | | - MWNamespace::getcontentNamespaces(), |
| 343 | | - array( NS_MAIN ) |
| | 336 | + array( NS_MAIN ), |
| | 337 | + MWNamespace::getcontentNamespaces() |
| 344 | 338 | ); |
| 345 | 339 | |
| 346 | 340 | $wgContentNamespaces = array( NS_MAIN, NS_USER, NS_CATEGORY ); |
| 347 | 341 | $this->assertEquals( |
| 348 | | - MWNamespace::getcontentNamespaces(), |
| 349 | | - array( NS_MAIN, NS_USER, NS_CATEGORY ) |
| | 342 | + array( NS_MAIN, NS_USER, NS_CATEGORY ), |
| | 343 | + MWNamespace::getcontentNamespaces() |
| 350 | 344 | ); |
| 351 | 345 | |
| 352 | 346 | } |
| — | — | @@ -456,7 +450,7 @@ |
| 457 | 451 | $this->assertFalse( MWNamespace::hasGenderDistinction( NS_SPECIAL ) ); |
| 458 | 452 | $this->assertFalse( MWNamespace::hasGenderDistinction( NS_MAIN ) ); |
| 459 | 453 | $this->assertFalse( MWNamespace::hasGenderDistinction( NS_TALK ) ); |
| 460 | | - |
| | 454 | + |
| 461 | 455 | } |
| 462 | 456 | } |
| 463 | 457 | |