You are here

public function ConfigDependenciesTest::testSchemeDependencies in Workbench Access 8

Tests scheme dependencies.

File

tests/src/Kernel/ConfigDependenciesTest.php, line 101

Class

ConfigDependenciesTest
Defines a class for testing config dependencies.

Namespace

Drupal\Tests\workbench_access\Kernel

Code

public function testSchemeDependencies() {
  $this
    ->assertEquals([
    'config' => [
      'field.field.node.page.field_section',
      'field.field.node.page.field_workbench_access',
      'taxonomy.vocabulary.workbench_access',
    ],
  ], $this->scheme
    ->getDependencies());
  $this
    ->assertEquals([
    'config' => [
      'node.type.article',
      'node.type.page',
      'system.menu.main',
    ],
  ], $this->menuScheme
    ->getDependencies());

  // Delete the article content type.
  NodeType::load('article')
    ->delete();
  $this->menuScheme = $this
    ->loadUnchangedScheme($this->menuScheme
    ->id());
  $this
    ->assertEquals([
    'config' => [
      'node.type.page',
      'system.menu.main',
    ],
  ], $this->menuScheme
    ->getDependencies());
  $this
    ->assertEquals([
    'page',
  ], $this->menuScheme
    ->getAccessScheme()
    ->getConfiguration()['bundles']);
  FieldConfig::load('node.page.field_section')
    ->delete();
  $this->scheme = $this
    ->loadUnchangedScheme($this->scheme
    ->id());
  $this
    ->assertEquals([
    'config' => [
      'field.field.node.page.field_workbench_access',
      'taxonomy.vocabulary.workbench_access',
    ],
  ], $this->scheme
    ->getDependencies());
}