NodeMakeUnstickyTest.php in Rules 8.3
File
tests/src/Unit/Integration/RulesAction/NodeMakeUnstickyTest.php
View source
<?php
namespace Drupal\Tests\rules\Unit\Integration\RulesAction;
use Drupal\node\NodeInterface;
use Drupal\Tests\rules\Unit\Integration\RulesEntityIntegrationTestBase;
class NodeMakeUnstickyTest extends RulesEntityIntegrationTestBase {
protected $action;
protected function setUp() : void {
parent::setUp();
$this->action = $this->actionManager
->createInstance('rules_node_make_unsticky');
}
public function testSummary() {
$this
->assertEquals('Make selected content not sticky', $this->action
->summary());
}
public function testActionExecution() {
$node = $this
->prophesizeEntity(NodeInterface::class);
$node
->setSticky(NodeInterface::NOT_STICKY)
->shouldBeCalledTimes(1);
$this->action
->setContextValue('node', $node
->reveal());
$this->action
->execute();
$this
->assertEquals([
'node',
], $this->action
->autoSaveContext(), 'Action returns the user context name for auto saving.');
}
}