function UserIsBlockedTest::testConditionEvaluation
Tests evaluating the condition.
@covers ::evaluate
File
-
tests/
src/ Unit/ Integration/ Condition/ UserIsBlockedTest.php, line 36
Class
- UserIsBlockedTest
- @coversDefaultClass \Drupal\rules\Plugin\Condition\UserIsBlocked @group RulesCondition
Namespace
Drupal\Tests\rules\Unit\Integration\ConditionCode
public function testConditionEvaluation() {
$blocked_user = $this->prophesizeEntity(UserInterface::class);
$blocked_user->isBlocked()
->willReturn(TRUE)
->shouldBeCalledTimes(1);
// Set the user context value.
$this->condition
->setContextValue('user', $blocked_user->reveal());
$this->assertTrue($this->condition
->evaluate());
$active_user = $this->prophesizeEntity(UserInterface::class);
$active_user->isBlocked()
->willReturn(FALSE)
->shouldBeCalledTimes(1);
// Set the user context value.
$this->condition
->setContextValue('user', $active_user->reveal());
$this->assertFalse($this->condition
->evaluate());
}