public function PublishActionTest::testPublishAction in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php \Drupal\KernelTests\Core\Action\PublishActionTest::testPublishAction()
- 10 core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php \Drupal\KernelTests\Core\Action\PublishActionTest::testPublishAction()
@covers \Drupal\Core\Action\Plugin\Action\PublishAction::execute
File
- core/
tests/ Drupal/ KernelTests/ Core/ Action/ PublishActionTest.php, line 46
Class
- PublishActionTest
- @group Action
Namespace
Drupal\KernelTests\Core\ActionCode
public function testPublishAction() {
$entity = EntityTestMulRevPub::create([
'name' => 'test',
]);
$entity
->setUnpublished()
->save();
$action = Action::create([
'id' => 'entity_publish_action',
'plugin' => 'entity:publish_action:entity_test_mulrevpub',
]);
$action
->save();
$this
->assertFalse($entity
->isPublished());
$action
->execute([
$entity,
]);
$this
->assertTrue($entity
->isPublished());
$this
->assertSame([
'module' => [
'entity_test',
],
], $action
->getDependencies());
}