X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiBlockTest.php;h=1c5314773a73b1f6c002e15501049b2ea61f57fd;hb=b54fc508c31836e41f6f949fe8fe24244dcb39c5;hp=01455edcafeff974a41268954ef19ff2de4a0c75;hpb=24755f024fe4efeab9f56a56073f75fc2ae3d7da;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index 01455edcaf..1c5314773a 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -62,7 +62,7 @@ class ApiBlockTest extends ApiTestCase { $this->assertTrue( !is_null( $block ), 'Block is valid' ); $this->assertSame( $this->mUser->getName(), (string)$block->getTarget() ); - $this->assertSame( 'Some reason', $block->mReason ); + $this->assertSame( 'Some reason', $block->getReason() ); return $ret; } @@ -175,6 +175,12 @@ class ApiBlockTest extends ApiTestCase { } public function testBlockWithEmailBlock() { + $this->setMwGlobals( [ + 'wgEnableEmail' => true, + 'wgEnableUserEmail' => true, + 'wgSysopEmailBans' => true, + ] ); + $res = $this->doBlock( [ 'noemail' => '' ] ); $dbw = wfGetDB( DB_MASTER ); @@ -187,6 +193,12 @@ class ApiBlockTest extends ApiTestCase { } public function testBlockWithProhibitedEmailBlock() { + $this->setMwGlobals( [ + 'wgEnableEmail' => true, + 'wgEnableUserEmail' => true, + 'wgSysopEmailBans' => true, + ] ); + $this->setExpectedException( ApiUsageException::class, "You don't have permission to block users from sending email through the wiki." );