public function NodeIsPromotedTest::testConditionEvaluation in Rules 8.3
Tests evaluating the condition.
@covers ::evaluate
File
- tests/
src/ Unit/ Integration/ Condition/ NodeIsPromotedTest.php, line 36
Class
- NodeIsPromotedTest
- @coversDefaultClass \Drupal\rules\Plugin\Condition\NodeIsPromoted @group RulesCondition
Namespace
Drupal\Tests\rules\Unit\Integration\ConditionCode
public function testConditionEvaluation() {
$promoted_node = $this
->prophesizeEntity(NodeInterface::class);
$promoted_node
->isPromoted()
->willReturn(TRUE)
->shouldBeCalledTimes(1);
// Set the node context value.
$this->condition
->setContextValue('node', $promoted_node
->reveal());
$this
->assertTrue($this->condition
->evaluate());
$unpromoted_node = $this
->prophesizeEntity(NodeInterface::class);
$unpromoted_node
->isPromoted()
->willReturn(FALSE)
->shouldBeCalledTimes(1);
// Set the node context value.
$this->condition
->setContextValue('node', $unpromoted_node
->reveal());
$this
->assertFalse($this->condition
->evaluate());
}