You are here

public function ConfigEntityBaseUnitTest::testCalculateDependencies in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testCalculateDependencies()

@covers ::calculateDependencies @covers ::getDependencies

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php, line 144
Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest.

Class

ConfigEntityBaseUnitTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testCalculateDependencies() {

  // Calculating dependencies will reset the dependencies array.
  $this->entity
    ->set('dependencies', array(
    'module' => array(
      'node',
    ),
  ));
  $this
    ->assertEmpty($this->entity
    ->calculateDependencies()
    ->getDependencies());

  // Calculating dependencies will reset the dependencies array using enforced
  // dependencies.
  $this->entity
    ->set('dependencies', array(
    'module' => array(
      'node',
    ),
    'enforced' => array(
      'module' => 'views',
    ),
  ));
  $dependencies = $this->entity
    ->calculateDependencies()
    ->getDependencies();
  $this
    ->assertContains('views', $dependencies['module']);
  $this
    ->assertNotContains('node', $dependencies['module']);
}