ConfigInstallerNestedDependenciesProfileTest.php in Configuration installer 8
File
tests/src/Functional/ConfigInstallerNestedDependenciesProfileTest.php
View source
<?php
namespace Drupal\Tests\config_installer\Functional;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Archiver\ArchiveTar;
use Drupal\Core\Config\FileStorage;
class ConfigInstallerNestedDependenciesProfileTest extends ConfigInstallerTestBase {
protected function prepareEnvironment() {
parent::prepareEnvironment();
$this->info = [
'type' => 'profile',
'core' => \Drupal::CORE_COMPATIBILITY,
'name' => 'Profile with nested dependencies',
'dependencies' => [
'nested',
],
];
$path = $this->siteDirectory . '/profiles/nested_dependencies_profile';
mkdir($path, 0777, TRUE);
file_put_contents("{$path}/nested_dependencies_profile.info.yml", Yaml::encode($this->info));
$this->nested = [
'type' => 'module',
'core' => \Drupal::CORE_COMPATIBILITY,
'name' => 'Nested module',
];
$nested_path = $path . '/modules/nested';
mkdir($nested_path, 0777, TRUE);
file_put_contents("{$nested_path}/nested.info.yml", Yaml::encode($this->nested));
}
protected function setUpSyncForm() {
$this
->drupalPostForm(NULL, [
'files[import_tarball]' => $this
->versionTarball('nested_dependencies_profile.tar.gz'),
], 'Save and continue');
}
public function testInstaller() {
parent::testInstaller();
$this
->assertTrue($this->container
->get('module_handler')
->moduleExists('nested'), 'A module provided by the profile is installed.');
}
}