Merge "rdbms: lower value of MAX_LAG_DEFAULT to 6"
[lhc/web/wiklou.git] / tests / phpunit / includes / specials / SpecialBlockTest.php
index 40fe1e3..0643e0e 100644 (file)
@@ -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 );
@@ -38,7 +40,6 @@ class SpecialBlockTest extends SpecialPageTestBase {
                $this->assertArrayHasKey( 'Reason', $fields );
                $this->assertArrayHasKey( 'CreateAccount', $fields );
                $this->assertArrayHasKey( 'DisableUTEdit', $fields );
-               $this->assertArrayHasKey( 'DisableUTEdit', $fields );
                $this->assertArrayHasKey( 'AutoBlock', $fields );
                $this->assertArrayHasKey( 'HardBlock', $fields );
                $this->assertArrayHasKey( 'PreviousTarget', $fields );
@@ -46,6 +47,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
 
                $this->assertArrayNotHasKey( 'EditingRestriction', $fields );
                $this->assertArrayNotHasKey( 'PageRestrictions', $fields );
+               $this->assertArrayNotHasKey( 'NamespaceRestrictions', $fields );
        }
 
        /**
@@ -61,6 +63,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
 
                $this->assertArrayHasKey( 'EditingRestriction', $fields );
                $this->assertArrayHasKey( 'PageRestrictions', $fields );
+               $this->assertArrayHasKey( 'NamespaceRestrictions', $fields );
        }
 
        /**
@@ -69,6 +72,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
        public function testMaybeAlterFormDefaults() {
                $this->setMwGlobals( [
                        'wgEnablePartialBlocks' => false,
+                       'wgBlockAllowsUTEdit' => true,
                ] );
 
                $block = $this->insertBlock();
@@ -116,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();
@@ -229,7 +234,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
        /**
         * @covers ::processForm()
         */
-       public function testProcessFormRestictions() {
+       public function testProcessFormRestrictions() {
                $this->setMwGlobals( [
                        'wgEnablePartialBlocks' => true,
                ] );
@@ -263,6 +268,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
                        'Watch' => '0',
                        'EditingRestriction' => 'partial',
                        'PageRestrictions' => implode( "\n", $titles ),
+                       'NamespaceRestrictions' => '',
                ];
                $result = $page->processForm( $data, $context );
 
@@ -316,6 +322,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
                        'Watch' => '0',
                        'EditingRestriction' => 'partial',
                        'PageRestrictions' => implode( "\n", $titles ),
+                       'NamespaceRestrictions' => '',
                ];
                $result = $page->processForm( $data, $context );