You are here

public function LingotekConfigDependenciesPostUpdateTest::testLingotekMetadataConfigDependenciesPostUpdate in Lingotek Translation 8

Tests that the Lingotek metadata dependencies are updated correctly.

File

src/Tests/Update/LingotekConfigDependenciesPostUpdateTest.php, line 28

Class

LingotekConfigDependenciesPostUpdateTest
Tests the upgrade path for updating the Lingotek metadata config dependencies.

Namespace

Drupal\lingotek\Tests\Update

Code

public function testLingotekMetadataConfigDependenciesPostUpdate() {

  // The dependencies are wrong.
  $type_metadata = LingotekConfigMetadata::load('node_type.article');
  $type_dependencies = $type_metadata
    ->getDependencies();
  $this
    ->assertEqual('node_type.article', $type_dependencies['config'][0]);
  $field_metadata = LingotekConfigMetadata::load('field_config.node.article.body');
  $field_dependencies = $field_metadata
    ->getDependencies();
  $this
    ->assertEqual('field_config.node.article.body', $field_dependencies['config'][0]);
  $this
    ->runUpdates();

  // The dependencies are calculated correctly.
  $type_metadata = LingotekConfigMetadata::load('node_type.article');
  $type_dependencies = $type_metadata
    ->getDependencies();
  $this
    ->assertEqual('node.type.article', $type_dependencies['config'][0]);
  $field_metadata = LingotekConfigMetadata::load('field_config.node.article.body');
  $field_dependencies = $field_metadata
    ->getDependencies();
  $this
    ->assertEqual('field.field.node.article.body', $field_dependencies['config'][0]);
}