Mercurial > hg > isophonics-drupal-site
comparison core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\FunctionalTests\Installer; | |
4 | |
5 use Drupal\Component\Serialization\Yaml; | |
6 use Drupal\Core\Site\Settings; | |
7 | |
8 /** | |
9 * Tests multiple distribution profile support. | |
10 * | |
11 * @group Installer | |
12 */ | |
13 class MultipleDistributionsProfileTest extends InstallerTestBase { | |
14 | |
15 /** | |
16 * The distribution profile info. | |
17 * | |
18 * @var array | |
19 */ | |
20 protected $info; | |
21 | |
22 /** | |
23 * {@inheritdoc} | |
24 */ | |
25 protected function prepareEnvironment() { | |
26 parent::prepareEnvironment(); | |
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->root . DIRECTORY_SEPARATOR . $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 | |
49 /** | |
50 * {@inheritdoc} | |
51 */ | |
52 protected function setUpLanguage() { | |
53 // Verify that the distribution name appears. | |
54 $this->assertRaw('distribution_one'); | |
55 // Verify that the requested theme is used. | |
56 $this->assertRaw('bartik'); | |
57 // Verify that the "Choose profile" step does not appear. | |
58 $this->assertNoText('profile'); | |
59 | |
60 parent::setUpLanguage(); | |
61 } | |
62 | |
63 /** | |
64 * {@inheritdoc} | |
65 */ | |
66 protected function setUpProfile() { | |
67 // This step is skipped, because there is a distribution profile. | |
68 } | |
69 | |
70 /** | |
71 * Confirms that the installation succeeded. | |
72 */ | |
73 public function testInstalled() { | |
74 $this->assertUrl('user/1'); | |
75 $this->assertResponse(200); | |
76 // Confirm that we are logged-in after installation. | |
77 $this->assertText($this->rootUser->getUsername()); | |
78 | |
79 // Confirm that Drupal recognizes this distribution as the current profile. | |
80 $this->assertEqual(\Drupal::installProfile(), 'distribution_one'); | |
81 $this->assertEqual(Settings::get('install_profile'), 'distribution_one', 'The install profile has been written to settings.php.'); | |
82 $this->assertEqual($this->config('core.extension')->get('profile'), 'distribution_one', 'The install profile has been written to core.extension configuration.'); | |
83 | |
84 $this->rebuildContainer(); | |
85 $this->pass('Container can be rebuilt as distribution is written to configuration.'); | |
86 $this->assertEqual(\Drupal::installProfile(), 'distribution_one'); | |
87 } | |
88 | |
89 } |