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