3 namespace Drupal\FunctionalTests\Installer;
5 use Drupal\Component\Serialization\Yaml;
8 * Tests multiple distribution profile support.
12 class MultipleDistributionsProfileTest extends InstallerTestBase {
15 * The distribution profile info.
24 protected function prepareEnvironment() {
25 parent::prepareEnvironment();
26 // Create two distributions.
27 foreach (['distribution_one', 'distribution_two'] as $name) {
30 'core' => \Drupal::CORE_COMPATIBILITY,
31 'name' => $name . ' profile',
39 // File API functions are not available yet.
40 $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/profiles/' . $name;
41 mkdir($path, 0777, TRUE);
42 file_put_contents("$path/$name.info.yml", Yaml::encode($info));
44 // Install the first distribution.
45 $this->profile = 'distribution_one';
51 protected function setUpLanguage() {
52 // Verify that the distribution name appears.
53 $this->assertRaw('distribution_one');
54 // Verify that the requested theme is used.
55 $this->assertRaw('bartik');
56 // Verify that the "Choose profile" step does not appear.
57 $this->assertNoText('profile');
59 parent::setUpLanguage();
65 protected function setUpProfile() {
66 // This step is skipped, because there is a distribution profile.
70 * Confirms that the installation succeeded.
72 public function testInstalled() {
73 $this->assertUrl('user/1');
74 $this->assertResponse(200);
75 // Confirm that we are logged-in after installation.
76 $this->assertText($this->rootUser->getUsername());
78 // Confirm that Drupal recognizes this distribution as the current profile.
79 $this->assertEqual(\Drupal::installProfile(), 'distribution_one');
80 $this->assertEqual($this->config('core.extension')->get('profile'), 'distribution_one', 'The install profile has been written to core.extension configuration.');
82 $this->rebuildContainer();
83 $this->pass('Container can be rebuilt as distribution is written to configuration.');
84 $this->assertEqual(\Drupal::installProfile(), 'distribution_one');