Mercurial > hg > isophonics-drupal-site
comparison core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\system\Tests\Installer; | |
4 | |
5 use Drupal\Component\Serialization\Yaml; | |
6 use Drupal\Core\Site\Settings; | |
7 use Drupal\simpletest\InstallerTestBase; | |
8 | |
9 /** | |
10 * Tests multiple distribution profile support. | |
11 * | |
12 * @group Installer | |
13 */ | |
14 class MultipleDistributionsProfileTest extends InstallerTestBase { | |
15 | |
16 /** | |
17 * The distribution profile info. | |
18 * | |
19 * @var array | |
20 */ | |
21 protected $info; | |
22 | |
23 /** | |
24 * {@inheritdoc} | |
25 */ | |
26 protected function setUp() { | |
27 // Create two distributions. | |
28 foreach (['distribution_one', 'distribution_two'] as $name) { | |
29 $info = [ | |
30 'type' => 'profile', | |
31 'core' => \Drupal::CORE_COMPATIBILITY, | |
32 'name' => $name . ' profile', | |
33 'distribution' => [ | |
34 'name' => $name, | |
35 'install' => [ | |
36 'theme' => 'bartik', | |
37 ], | |
38 ], | |
39 ]; | |
40 // File API functions are not available yet. | |
41 $path = $this->siteDirectory . '/profiles/' . $name; | |
42 mkdir($path, 0777, TRUE); | |
43 file_put_contents("$path/$name.info.yml", Yaml::encode($info)); | |
44 } | |
45 // Install the first distribution. | |
46 $this->profile = 'distribution_one'; | |
47 | |
48 parent::setUp(); | |
49 } | |
50 | |
51 /** | |
52 * {@inheritdoc} | |
53 */ | |
54 protected function setUpLanguage() { | |
55 // Verify that the distribution name appears. | |
56 $this->assertRaw('distribution_one'); | |
57 // Verify that the requested theme is used. | |
58 $this->assertRaw('bartik'); | |
59 // Verify that the "Choose profile" step does not appear. | |
60 $this->assertNoText('profile'); | |
61 | |
62 parent::setUpLanguage(); | |
63 } | |
64 | |
65 /** | |
66 * {@inheritdoc} | |
67 */ | |
68 protected function setUpProfile() { | |
69 // This step is skipped, because there is a distribution profile. | |
70 } | |
71 | |
72 /** | |
73 * Confirms that the installation succeeded. | |
74 */ | |
75 public function testInstalled() { | |
76 $this->assertUrl('user/1'); | |
77 $this->assertResponse(200); | |
78 // Confirm that we are logged-in after installation. | |
79 $this->assertText($this->rootUser->getUsername()); | |
80 | |
81 // Confirm that Drupal recognizes this distribution as the current profile. | |
82 $this->assertEqual(\Drupal::installProfile(), 'distribution_one'); | |
83 $this->assertEqual(Settings::get('install_profile'), 'distribution_one', 'The install profile has been written to settings.php.'); | |
84 $this->assertEqual($this->config('core.extension')->get('profile'), 'distribution_one', 'The install profile has been written to core.extension configuration.'); | |
85 | |
86 $this->rebuildContainer(); | |
87 $this->pass('Container can be rebuilt as distribution is written to configuration.'); | |
88 $this->assertEqual(\Drupal::installProfile(), 'distribution_one'); | |
89 } | |
90 | |
91 } |