MoveActionsToCoreTest.php in Drupal 8
File
core/modules/system/tests/src/Functional/Update/MoveActionsToCoreTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\system\Entity\Action;
class MoveActionsToCoreTest extends UpdatePathTestBase {
protected $defaultTheme = 'stark';
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../tests/fixtures/update/drupal-8.4.0.bare.standard.php.gz',
__DIR__ . '/../../../../tests/fixtures/update/drupal-8.actions-2815379.php',
];
}
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) {
$action = Action::load($key);
$this
->assertSame([], $action
->getDependencies());
$config = \Drupal::configFactory()
->get('system.action.' . $key);
$after = $before[$key];
$after['dependencies'] = [];
$this
->assertSame($after, $config
->getRawData());
}
}
}