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