<?php
+use MediaWiki\Block\DatabaseBlock;
use MediaWiki\Block\Restriction\PageRestriction;
/**
public function testCanExecute() {
$user = $this->getTestUser()->getUser();
- $user->mRights = [ 'access' ];
+ $this->overrideUserPermissions( $user, 'access' );
$action = Action::factory( 'access', $this->getPage(), $this->getContext() );
$this->assertNull( $action->canExecute( $user ) );
}
public function testCanExecuteNoRight() {
$user = $this->getTestUser()->getUser();
- $user->mRights = [];
+ $this->overrideUserPermissions( $user, [] );
$action = Action::factory( 'access', $this->getPage(), $this->getContext() );
try {
public function testCanExecuteRequiresUnblock() {
$user = $this->getTestUser()->getUser();
- $user->mRights = [];
+ $this->overrideUserPermissions( $user, [] );
$page = $this->getExistingTestPage();
$action = Action::factory( 'unblock', $page, $this->getContext() );
- $block = new Block( [
+ $block = new DatabaseBlock( [
'address' => $user,
'by' => $this->getTestSysop()->getUser()->getId(),
'expiry' => 'infinity',