3 namespace Drupal\Tests\system\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6 use Drupal\system\Entity\Action;
9 * Tests upgrading comment and node actions to generic entity ones.
13 class UpdateActionsWithEntityPluginsTest extends UpdatePathTestBase {
18 protected function setDatabaseDumpFiles() {
19 $this->databaseDumpFiles = [__DIR__ . '/../../../../tests/fixtures/update/drupal-8.bare.standard.php.gz'];
23 * Tests upgrading comment and node actions to generic entity ones.
25 * @see system_post_update_change_action_plugins()
27 public function testUpdateActionsWithEntityPlugins() {
28 $old_new_action_id_map = [
29 'comment_publish_action' => ['comment_publish_action', 'entity:publish_action:comment'],
30 'comment_unpublish_action' => ['comment_unpublish_action', 'entity:unpublish_action:comment'],
31 'comment_save_action' => ['comment_save_action', 'entity:save_action:comment'],
32 'node_publish_action' => ['node_publish_action', 'entity:publish_action:node'],
33 'node_unpublish_action' => ['node_unpublish_action', 'entity:unpublish_action:node'],
34 'node_save_action' => ['node_save_action', 'entity:save_action:node'],
37 foreach ($old_new_action_id_map as $key => list($before, $after)) {
38 $config = \Drupal::configFactory()->get('system.action.' . $key);
39 $this->assertSame($before, $config->get('plugin'));
44 foreach ($old_new_action_id_map as $key => list($before, $after)) {
45 /** @var \Drupal\system\Entity\Action $action */
46 $action = Action::load($key);
47 $this->assertSame($after, $action->getPlugin()->getPluginId());
48 $config = \Drupal::configFactory()->get('system.action.' . $key);
49 $this->assertSame($after, $config->get('plugin'));
51 // Check that the type the action is based on will be a module dependency.
52 $this->assertArraySubset(['module' => [$action->getPluginDefinition()['type']]], $action->getDependencies());