Namespace
Drupal\Tests\rules\Unit\Integration\Condition
File
-
tests/src/Unit/Integration/Condition/UserIsBlockedTest.php
View source
<?php
namespace Drupal\Tests\rules\Unit\Integration\Condition;
use Drupal\Tests\rules\Unit\Integration\RulesEntityIntegrationTestBase;
use Drupal\user\UserInterface;
class UserIsBlockedTest extends RulesEntityIntegrationTestBase {
protected $condition;
protected function setUp() : void {
parent::setUp();
$this->enableModule('user');
$this->condition = $this->conditionManager
->createInstance('rules_user_is_blocked');
}
public function testConditionEvaluation() {
$blocked_user = $this->prophesizeEntity(UserInterface::class);
$blocked_user->isBlocked()
->willReturn(TRUE)
->shouldBeCalledTimes(1);
$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);
$this->condition
->setContextValue('user', $active_user->reveal());
$this->assertFalse($this->condition
->evaluate());
}
}
Classes
| Title |
Deprecated |
Summary |
| UserIsBlockedTest |
|
@coversDefaultClass \Drupal\rules\Plugin\Condition\UserIsBlocked[[api-linebreak]]
@group RulesCondition |