3 namespace MediaWiki\Tests\Block\Restriction
;
5 use MediaWiki\Block\Restriction\NamespaceRestriction
;
10 * @covers \MediaWiki\Block\Restriction\AbstractRestriction
11 * @covers \MediaWiki\Block\Restriction\NamespaceRestriction
13 class NamespaceRestrictionTest
extends RestrictionTestCase
{
15 public function testMatches() {
16 $class = $this->getClass();
17 $page = $this->getExistingTestPage( 'Saturn' );
18 $restriction = new $class( 1, NS_MAIN
);
19 $this->assertTrue( $restriction->matches( $page->getTitle() ) );
21 $page = $this->getExistingTestPage( 'Talk:Saturn' );
22 $this->assertFalse( $restriction->matches( $page->getTitle() ) );
25 public function testGetType() {
26 $class = $this->getClass();
27 $restriction = new $class( 1, 2 );
28 $this->assertEquals( 'ns', $restriction->getType() );
34 protected function getClass() {
35 return NamespaceRestriction
::class;