comparison core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.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\Core\Serialization\Yaml;
6 use Drupal\Core\Site\Settings;
7
8 /**
9 * Tests distribution profile support.
10 *
11 * @group Installer
12 */
13 class DistributionProfileTest extends InstallerTestBase {
14
15 /**
16 * The distribution profile info.
17 *
18 * @var array
19 */
20 protected $info;
21
22 protected function prepareEnvironment() {
23 parent::prepareEnvironment();
24 $this->info = [
25 'type' => 'profile',
26 'core' => \Drupal::CORE_COMPATIBILITY,
27 'name' => 'Distribution profile',
28 'distribution' => [
29 'name' => 'My Distribution',
30 'install' => [
31 'theme' => 'bartik',
32 ],
33 ],
34 ];
35 // File API functions are not available yet.
36 $path = $this->siteDirectory . '/profiles/mydistro';
37 mkdir($path, 0777, TRUE);
38 file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info));
39 }
40
41 /**
42 * {@inheritdoc}
43 */
44 protected function setUpLanguage() {
45 // Verify that the distribution name appears.
46 $this->assertRaw($this->info['distribution']['name']);
47 // Verify that the distribution name is used in the site title.
48 $this->assertTitle('Choose language | ' . $this->info['distribution']['name']);
49 // Verify that the requested theme is used.
50 $this->assertRaw($this->info['distribution']['install']['theme']);
51 // Verify that the "Choose profile" step does not appear.
52 $this->assertNoText('profile');
53
54 parent::setUpLanguage();
55 }
56
57 /**
58 * {@inheritdoc}
59 */
60 protected function setUpProfile() {
61 // This step is skipped, because there is a distribution profile.
62 }
63
64 /**
65 * Confirms that the installation succeeded.
66 */
67 public function testInstalled() {
68 $this->assertUrl('user/1');
69 $this->assertResponse(200);
70 // Confirm that we are logged-in after installation.
71 $this->assertText($this->rootUser->getUsername());
72
73 // Confirm that Drupal recognizes this distribution as the current profile.
74 $this->assertEqual(\Drupal::installProfile(), 'mydistro');
75 $this->assertEqual(Settings::get('install_profile'), 'mydistro', 'The install profile has been written to settings.php.');
76 $this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.');
77 }
78
79 }