function PublishActionTest::testUnpublishAction
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php \Drupal\KernelTests\Core\Action\PublishActionTest::testUnpublishAction()
- 8.9.x core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php \Drupal\KernelTests\Core\Action\PublishActionTest::testUnpublishAction()
- 11.x core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php \Drupal\KernelTests\Core\Action\PublishActionTest::testUnpublishAction()
@covers \Drupal\Core\Action\Plugin\Action\UnpublishAction::execute
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Action/ PublishActionTest.php, line 66
Class
- PublishActionTest
- @group Action
Namespace
Drupal\KernelTests\Core\ActionCode
public function testUnpublishAction() : void {
$entity = EntityTestMulRevPub::create([
'name' => 'test',
]);
$entity->setPublished()
->save();
$action = Action::create([
'id' => 'entity_unpublish_action',
'plugin' => 'entity:unpublish_action:entity_test_mulrevpub',
]);
$action->save();
$this->assertTrue($entity->isPublished());
$action->execute([
$entity,
]);
$this->assertFalse($entity->isPublished());
$this->assertSame([
'module' => [
'entity_test',
],
], $action->getDependencies());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.