According to the coding standards we even enforce with a custom PHPCS sniff. It currently does not pick these mistakes up because of the curly brackets. I'm not sure if this is worth an update of the PHPCS sniff. I wanted to suggest this fix anyway. Change-Id: I9041ea7a00baf7f55e0ff0e56879a89fb74bb479
37 lines
950 B
PHP
37 lines
950 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Tests\Block\Restriction;
|
|
|
|
use MediaWiki\Block\Restriction\NamespaceRestriction;
|
|
|
|
/**
|
|
* @group Database
|
|
* @group Blocking
|
|
* @covers \MediaWiki\Block\Restriction\AbstractRestriction
|
|
* @covers \MediaWiki\Block\Restriction\NamespaceRestriction
|
|
*/
|
|
class NamespaceRestrictionTest extends RestrictionTestCase {
|
|
|
|
public function testMatches() {
|
|
$class = $this->getClass();
|
|
$page = $this->getExistingTestPage( 'Saturn' );
|
|
$restriction = new $class( 1, NS_MAIN );
|
|
$this->assertTrue( $restriction->matches( $page->getTitle() ) );
|
|
|
|
$page = $this->getExistingTestPage( 'Talk:Saturn' );
|
|
$this->assertFalse( $restriction->matches( $page->getTitle() ) );
|
|
}
|
|
|
|
public function testGetType() {
|
|
$class = $this->getClass();
|
|
$restriction = new $class( 1, 2 );
|
|
$this->assertEquals( 'ns', $restriction->getType() );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected function getClass() {
|
|
return NamespaceRestriction::class;
|
|
}
|
|
}
|