if(empty($optional_config_storage->listAll()) && empty($extension_config_storage->listAll())){ $this->markTestSkipped("$name has no configuration to test"); }
// Work out any additional modules and themes that need installing to create
// an optional config.
$modules_to_install = $type !== 'theme' ? [$name] : []; $themes_to_install = $type === 'theme' ? [$name] : []; foreach($optional_config_storage->listAll()as$config_name){ $data = $optional_config_storage->read($config_name); $dependency = newConfigEntityDependency($config_name, $data); $modules_to_install = array_merge($modules_to_install, $dependency->getDependencies('module')); $themes_to_install = array_merge($themes_to_install, $dependency->getDependencies('theme')); } // Remove core and standard because they cannot be installed.
$modules_to_install = array_diff(array_unique($modules_to_install), ['core', 'standard']); $this->container->get('module_installer')->install($modules_to_install); $this->container->get('theme_installer')->install(array_unique($themes_to_install));
// Test configuration in the extension's config/install directory.
$this->doTestsOnConfigStorage($extension_config_storage, $name, $type);
use Drupal\Tests\UnitTestCase; use Drupal\Core\Config\Entity\ConfigEntityDependency;