You are here

public function UserBlockTest::testBlockUserWithBlockedAnonymousUser in Rules 8.3

Test execute() method for blocked and anonymous users.

@covers ::execute

File

tests/src/Unit/Integration/RulesAction/UserBlockTest.php, line 134

Class

UserBlockTest
@coversDefaultClass \Drupal\rules\Plugin\RulesAction\UserBlock @group RulesAction

Namespace

Drupal\Tests\rules\Unit\Integration\RulesAction

Code

public function testBlockUserWithBlockedAnonymousUser() {
  $user = $this
    ->getUserMock(self::BLOCKED, 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.');
}