function UserBlockTest::getUserMock
Creates a mock user.
Parameters
bool $active: Is user activated.
bool $authenticated: Is user authenticated.
Return value
\Drupal\user\UserInterface|\Prophecy\Prophecy\ProphecyInterface The mocked user object.
4 calls to UserBlockTest::getUserMock()
- UserBlockTest::testBlockUserWithActiveAnonymousUser in tests/
src/ Unit/ Integration/ RulesAction/ UserBlockTest.php - Test execute() method for active and anonymous users.
- UserBlockTest::testBlockUserWithBlockedAnonymousUser in tests/
src/ Unit/ Integration/ RulesAction/ UserBlockTest.php - Test execute() method for blocked and anonymous users.
- UserBlockTest::testBlockUserWithBlockedAuthenticatedUser in tests/
src/ Unit/ Integration/ RulesAction/ UserBlockTest.php - Test execute() method for blocked and authenticated users.
- UserBlockTest::testBlockUserWithValidUser in tests/
src/ Unit/ Integration/ RulesAction/ UserBlockTest.php - Test execute() method for active and authenticated users.
File
-
tests/
src/ Unit/ Integration/ RulesAction/ UserBlockTest.php, line 159
Class
- UserBlockTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesAction\UserBlock @group RulesAction
Namespace
Drupal\Tests\rules\Unit\Integration\RulesActionCode
protected function getUserMock($active, $authenticated) {
$user = $this->prophesizeEntity(UserInterface::class);
$user->isActive()
->willReturn($active);
$user->isAuthenticated()
->willReturn($authenticated);
return $user;
}