public function UserBlockTest::testBlockUserWithActiveAnonymousUser in Rules 8.3
Test execute() method for active and anonymous users.
@covers ::execute
File
- tests/
src/ Unit/ Integration/ RulesAction/ UserBlockTest.php, line 96
Class
- UserBlockTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesAction\UserBlock @group RulesAction
Namespace
Drupal\Tests\rules\Unit\Integration\RulesActionCode
public function testBlockUserWithActiveAnonymousUser() {
$user = $this
->getUserMock(self::ACTIVE, self::ANONYMOUS);
$user
->block()
->shouldNotBeCalled();
$this->sessionManager
->delete()
->shouldNotBeCalled();
$this->action
->setContextValue('user', $user
->reveal());
$this->action
->execute();
$this
->assertEquals($this->action
->autoSaveContext(), [], 'Action returns nothing for auto saving since the user has not been altered.');
}