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