* @covers Title::checkUserBlock
*/
public function testUserBlock() {
- global $wgEmailConfirmToEdit, $wgEmailAuthentication;
- $wgEmailConfirmToEdit = true;
- $wgEmailAuthentication = true;
+ $this->setMwGlobals( [
+ 'wgEmailConfirmToEdit' => true,
+ 'wgEmailAuthentication' => true,
+ ] );
$this->setUserPerm( [ "createpage", "move" ] );
$this->setTitle( NS_HELP, "test page" );
- # $short
- $this->assertEquals( [ [ 'confirmedittext' ] ],
+ # $wgEmailConfirmToEdit only applies to 'edit' action
+ $this->assertEquals( [],
$this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
- $wgEmailConfirmToEdit = false;
- $this->assertEquals( true, $this->title->userCan( 'move-target', $this->user ) );
+ $this->assertContains( [ 'confirmedittext' ],
+ $this->title->getUserPermissionsErrors( 'edit', $this->user ) );
+
+ $this->setMwGlobals( 'wgEmailConfirmToEdit', false );
+ $this->assertNotContains( [ 'confirmedittext' ],
+ $this->title->getUserPermissionsErrors( 'edit', $this->user ) );
# $wgEmailConfirmToEdit && !$user->isEmailConfirmed() && $action != 'createaccount'
$this->assertEquals( [],