RecalculatedDependencyTest.php in Zircon Profile 8
File
core/modules/system/src/Tests/Update/RecalculatedDependencyTest.php
View source
<?php
namespace Drupal\system\Tests\Update;
class RecalculatedDependencyTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
];
}
public function testUpdate() {
$data = \Drupal::config('field.field.node.article.field_tags')
->get();
$this
->assertEqual([
'entity_reference',
], $data['dependencies']['module']);
$this
->assertEqual([
'field.storage.node.field_tags',
'node.type.article',
], $data['dependencies']['config']);
$data = \Drupal::config('field.field.user.user.user_picture')
->get();
$this
->assertFalse(isset($data['dependencies']['module']));
$data = \Drupal::config('field.storage.node.field_image')
->get();
$this
->assertEqual([
'node',
'image',
], $data['dependencies']['module']);
$config_storage = \Drupal::service('config.storage');
$data = $config_storage
->read('search.page.node_search');
unset($data['dependencies']);
$config_storage
->write('search.page.node_search', $data);
$data = \Drupal::config('search.page.node_search')
->get();
$this
->assertFalse(isset($data['dependencies']['module']));
$this
->runUpdates();
$data = \Drupal::config('field.field.node.article.field_tags')
->get();
$this
->assertFalse(isset($data['dependencies']['module']));
$this
->assertEqual([
'field.storage.node.field_tags',
'node.type.article',
'taxonomy.vocabulary.tags',
], $data['dependencies']['config']);
$data = \Drupal::config('field.field.user.user.user_picture')
->get();
$this
->assertEqual([
'image',
'user',
], $data['dependencies']['module']);
$data = \Drupal::config('field.storage.node.field_image')
->get();
$this
->assertEqual([
'file',
'image',
'node',
], $data['dependencies']['module']);
$data = \Drupal::config('search.page.node_search')
->get();
$this
->assertEqual([
'node',
], $data['dependencies']['module']);
}
}