Set BlockDisablesLogin false for Blocking group tests that assume this
authorThalia <thalia.e.chan@googlemail.com>
Tue, 19 Feb 2019 20:16:21 +0000 (20:16 +0000)
committerThalia <thalia.e.chan@googlemail.com>
Tue, 19 Feb 2019 20:17:48 +0000 (20:17 +0000)
The global config $wgBlockDisablesLogin can override certain block flags
if true, causing some tests to fail. Set it to false for these tests.

Change-Id: I497ef07bd34a1e458fd9692ef4874474e61151c8

tests/phpunit/includes/BlockTest.php
tests/phpunit/includes/block/BlockRestrictionTest.php
tests/phpunit/includes/specials/SpecialBlockTest.php

index a151080..f20481b 100644 (file)
@@ -616,6 +616,9 @@ class BlockTest extends MediaWikiLangTestCase {
         * @covers Block::appliesToTitle
         */
        public function testAppliesToTitleReturnsTrueOnSitewideBlock() {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $user = $this->getTestUser()->getUser();
                $block = new Block( [
                        'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
@@ -642,6 +645,9 @@ class BlockTest extends MediaWikiLangTestCase {
         * @covers Block::appliesToTitle
         */
        public function testAppliesToTitleOnPartialBlock() {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $user = $this->getTestUser()->getUser();
                $block = new Block( [
                        'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
@@ -673,6 +679,9 @@ class BlockTest extends MediaWikiLangTestCase {
         * @covers Block::appliesToPage
         */
        public function testAppliesToReturnsTrueOnSitewideBlock() {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $user = $this->getTestUser()->getUser();
                $block = new Block( [
                        'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
@@ -697,6 +706,9 @@ class BlockTest extends MediaWikiLangTestCase {
         * @covers Block::appliesToPage
         */
        public function testAppliesToPageOnPartialPageBlock() {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $user = $this->getTestUser()->getUser();
                $block = new Block( [
                        'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
@@ -725,6 +737,9 @@ class BlockTest extends MediaWikiLangTestCase {
         * @covers Block::appliesToNamespace
         */
        public function testAppliesToNamespaceOnPartialNamespaceBlock() {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $user = $this->getTestUser()->getUser();
                $block = new Block( [
                        'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
@@ -749,6 +764,9 @@ class BlockTest extends MediaWikiLangTestCase {
         * @covers Block::prevents
         */
        public function testBlockAllowsPurge() {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $block = new Block();
                $this->assertFalse( $block->prevents( 'purge' ) );
        }
index 2d78018..5bbd3d0 100644 (file)
@@ -25,6 +25,9 @@ class BlockRestrictionTest extends \MediaWikiLangTestCase {
         * @covers ::rowToRestriction
         */
        public function testLoadMultipleRestrictions() {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $block = $this->insertBlock();
 
                $pageFoo = $this->getExistingTestPage( 'Foo' );
index a17f39d..0b3adc0 100644 (file)
@@ -401,6 +401,9 @@ class SpecialBlockTest extends SpecialPageTestBase {
                $expectedResult,
                $reason
        ) {
+               $this->setMwGlobals( [
+                       'wgBlockDisablesLogin' => false,
+               ] );
                $this->setGroupPermissions( 'sysop', 'unblockself', true );
                $this->setGroupPermissions( 'user', 'block', true );
                // Getting errors about creating users in db in provider.