function MoveActionsToCoreTest::testUpdateActionPlugins

Tests upgrading actions to core namespace.

See also

action_post_update_move_plugins()

File

core/modules/system/tests/src/Functional/Update/MoveActionsToCoreTest.php, line 36

Class

MoveActionsToCoreTest
Tests moving email, goto, and message actions to core namespace.

Namespace

Drupal\Tests\system\Functional\Update

Code

public function testUpdateActionPlugins() {
  $actions = [
    'goto_2815379',
    'message_2815379',
    'send_email_2815379',
  ];
  $before = [];
  $dependencies = [
    'module' => [
      'action',
    ],
  ];
  foreach ($actions as $key) {
    $config = \Drupal::configFactory()->get('system.action.' . $key);
    $this->assertSame($dependencies, $config->get('dependencies'));
    $before[$key] = $config->getRawData();
  }
  $this->runUpdates();
  foreach ($actions as $key) {
    /** @var \Drupal\system\Entity\Action $key */
    $action = Action::load($key);
    $this->assertSame([], $action->getDependencies());
    // Tests that other properties remains the same.
    $config = \Drupal::configFactory()->get('system.action.' . $key);
    $after = $before[$key];
    $after['dependencies'] = [];
    $this->assertSame($after, $config->getRawData());
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.