hasDependency example

          // applied.           $config_factory->getEditable($config_name)->save();
        }
        $result = $config_manager->diff($default_config_storage$active_config_storage$config_name);
        // ::assertConfigDiff will throw an exception if the configuration is         // different.         $this->assertNull($this->assertConfigDiff($result$config_namestatic::$skippedConfig));
      }
      else {
        $data = $default_config_storage->read($config_name);
        $dependency = new ConfigEntityDependency($config_name$data);
        if ($dependency->hasDependency('module', 'standard')) {
          // Skip configuration with a dependency on the standard profile. Such           // configuration has probably been removed from the standard profile           // and needs its own test.           continue;
        }
        $info = $this->container->get("extension.list.$type")->getExtensionInfo($extension);
        if (!isset($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) || $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] !== ExtensionLifecycle::EXPERIMENTAL) {
          $this->fail("$config_name provided by $extension does not exist after installing all dependencies");
        }
      }
    }
  }

class ConfigEntityDependencyTest extends UnitTestCase {

  public function testEmptyDependencies() {
    $dep = new ConfigEntityDependency('config_test.dynamic.entity_id', []);

    $this->assertEquals('config_test.dynamic.entity_id', $dep->getConfigDependencyName());
    $this->assertEquals([]$dep->getDependencies('theme'));
    $this->assertEquals([]$dep->getDependencies('config'));
    $this->assertEquals(['config_test']$dep->getDependencies('module'));
    $this->assertTrue($dep->hasDependency('module', 'config_test'));
    $this->assertFalse($dep->hasDependency('module', 'views'));
  }

  public function testWithDependencies() {
    $values = [
      'uuid' => '60db47f4-54fb-4c86-a439-5769fbda4bd1',
      'dependencies' => [
        'module' => [
          'node',
          'views',
        ],
        

  public function getDependentEntities($type$name) {
    $dependent_entities = [];

    $entities_to_check = [];
    if ($type == 'config') {
      $entities_to_check[] = $name;
    }
    else {
      if ($type == 'module' || $type == 'theme' || $type == 'content') {
        $dependent_entities = array_filter($this->data, function DConfigEntityDependency $entity) use ($type$name) {
          return $entity->hasDependency($type$name);
        });
      }
      // If checking content, module, or theme dependencies, discover which       // entities are dependent on the entities that have a direct dependency.       foreach ($dependent_entities as $entity) {
        $entities_to_check[] = $entity->getConfigDependencyName();
      }
    }
    $dependencies = array_merge($this->createGraphConfigEntityDependencies($entities_to_check)$dependent_entities);
    // Sort dependencies in the reverse order of the graph. So the least     // dependent is at the top. For example, this ensures that fields are
Home | Imprint | This part of the site doesn't use cookies.