Index: trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php |
— | — | @@ -182,25 +182,28 @@ |
183 | 183 | * Test MWNamespace::subjectEquals |
184 | 184 | */ |
185 | 185 | public function testSubjectEquals() { |
186 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_MAIN, NS_MAIN ) ); |
187 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_MAIN, 0 ) ); // In case we make NS_MAIN 'MAIN' |
188 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_USER, NS_USER ) ); |
189 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_USER, 2 ) ); |
190 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_USER_TALK, NS_USER_TALK ) ); |
191 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_SPECIAL, NS_SPECIAL ) ); |
192 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_MAIN, NS_TALK ) ); |
193 | | - $this->assertTrue( MWNamespace::subjectEquals( NS_USER, NS_USER_TALK ) ); |
194 | | - $this->assertFalse( MWNamespace::subjectEquals( NS_PROJECT, NS_TEMPLATE ) ); |
195 | | - $this->assertFalse( MWNamespace::subjectEquals( NS_SPECIAL, NS_MAIN ) ); |
| 186 | + $this->assertSameSubject( NS_MAIN, NS_MAIN ); |
| 187 | + $this->assertSameSubject( NS_MAIN, 0 ); // In case we make NS_MAIN 'MAIN' |
| 188 | + $this->assertSameSubject( NS_USER, NS_USER ); |
| 189 | + $this->assertSameSubject( NS_USER, 2 ); |
| 190 | + $this->assertSameSubject( NS_USER_TALK, NS_USER_TALK ); |
| 191 | + $this->assertSameSubject( NS_SPECIAL, NS_SPECIAL ); |
| 192 | + $this->assertSameSubject( NS_MAIN, NS_TALK ); |
| 193 | + $this->assertSameSubject( NS_USER, NS_USER_TALK ); |
| 194 | + |
| 195 | + $this->assertDifferentSubject( NS_PROJECT, NS_TEMPLATE ); |
| 196 | + $this->assertDifferentSubject( NS_SPECIAL, NS_MAIN ); |
196 | 197 | } |
197 | 198 | |
198 | 199 | public function testSpecialAndMediaAreDifferentSubjects() { |
199 | | - $this->assertFalse( MWNamespace::subjectEquals( |
200 | | - NS_MEDIA, NS_SPECIAL |
201 | | - ), "NS_MEDIA and NS_SPECIAL are different subhects" ); |
202 | | - $this->assertFalse( MWNamespace::subjectEquals( |
203 | | - NS_SPECIAL, NS_MEDIA |
204 | | - ), "NS_SPECIAL and NS_MEDIA are different subhects" ); |
| 200 | + $this->assertDifferentSubject( |
| 201 | + NS_MEDIA, NS_SPECIAL, |
| 202 | + "NS_MEDIA and NS_SPECIAL are different subhects" |
| 203 | + ); |
| 204 | + $this->assertDifferentSubject( |
| 205 | + NS_SPECIAL, NS_MEDIA, |
| 206 | + "NS_SPECIAL and NS_MEDIA are different subhects" |
| 207 | + ); |
205 | 208 | |
206 | 209 | } |
207 | 210 | |
— | — | @@ -580,5 +583,11 @@ |
581 | 584 | throw new Exception( __METHOD__ . " could not find a method named $method\n" ); |
582 | 585 | } |
583 | 586 | |
| 587 | + function assertSameSubject( $ns1, $ns2, $msg = '' ) { |
| 588 | + $this->assertTrue( MWNamespace::subjectEquals( $ns1, $ns2, $msg ) ); |
| 589 | + } |
| 590 | + function assertDifferentSubject( $ns1, $ns2, $msg = '' ) { |
| 591 | + $this->assertFalse( MWNamespace::subjectEquals( $ns1, $ns2, $msg ) ); |
| 592 | + } |
584 | 593 | } |
585 | 594 | |