X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fspecials%2FSpecialBlockTest.php;h=0643e0e5ad1c47a8029be798449d48a498aff0cb;hb=d7678fa45e949a5a5eaa369b45e48667a6132c07;hp=e2c0084b210e2a7d527a9c5d4e5f1713935a222a;hpb=7f9270774494adf8ef42c6cadbcab7ce1fe874b6;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/specials/SpecialBlockTest.php b/tests/phpunit/includes/specials/SpecialBlockTest.php index e2c0084b21..0643e0e5ad 100644 --- a/tests/phpunit/includes/specials/SpecialBlockTest.php +++ b/tests/phpunit/includes/specials/SpecialBlockTest.php @@ -2,6 +2,7 @@ use MediaWiki\Block\BlockRestriction; use MediaWiki\Block\Restriction\PageRestriction; +use MediaWiki\Block\Restriction\NamespaceRestriction; use Wikimedia\TestingAccessWrapper; /** @@ -28,6 +29,7 @@ class SpecialBlockTest extends SpecialPageTestBase { public function testGetFormFields() { $this->setMwGlobals( [ 'wgEnablePartialBlocks' => false, + 'wgBlockAllowsUTEdit' => true, ] ); $page = $this->newSpecialPage(); $wrappedPage = TestingAccessWrapper::newFromObject( $page ); @@ -45,6 +47,7 @@ class SpecialBlockTest extends SpecialPageTestBase { $this->assertArrayNotHasKey( 'EditingRestriction', $fields ); $this->assertArrayNotHasKey( 'PageRestrictions', $fields ); + $this->assertArrayNotHasKey( 'NamespaceRestrictions', $fields ); } /** @@ -60,6 +63,7 @@ class SpecialBlockTest extends SpecialPageTestBase { $this->assertArrayHasKey( 'EditingRestriction', $fields ); $this->assertArrayHasKey( 'PageRestrictions', $fields ); + $this->assertArrayHasKey( 'NamespaceRestrictions', $fields ); } /** @@ -68,6 +72,7 @@ class SpecialBlockTest extends SpecialPageTestBase { public function testMaybeAlterFormDefaults() { $this->setMwGlobals( [ 'wgEnablePartialBlocks' => false, + 'wgBlockAllowsUTEdit' => true, ] ); $block = $this->insertBlock(); @@ -115,6 +120,7 @@ class SpecialBlockTest extends SpecialPageTestBase { $block->setRestrictions( [ new PageRestriction( 0, $pageSaturn->getId() ), new PageRestriction( 0, $pageMars->getId() ), + new NamespaceRestriction( 0, NS_TALK ), ] ); $block->insert(); @@ -228,7 +234,7 @@ class SpecialBlockTest extends SpecialPageTestBase { /** * @covers ::processForm() */ - public function testProcessFormRestictions() { + public function testProcessFormRestrictions() { $this->setMwGlobals( [ 'wgEnablePartialBlocks' => true, ] ); @@ -262,6 +268,7 @@ class SpecialBlockTest extends SpecialPageTestBase { 'Watch' => '0', 'EditingRestriction' => 'partial', 'PageRestrictions' => implode( "\n", $titles ), + 'NamespaceRestrictions' => '', ]; $result = $page->processForm( $data, $context ); @@ -315,6 +322,7 @@ class SpecialBlockTest extends SpecialPageTestBase { 'Watch' => '0', 'EditingRestriction' => 'partial', 'PageRestrictions' => implode( "\n", $titles ), + 'NamespaceRestrictions' => '', ]; $result = $page->processForm( $data, $context );