be51057ad80655e0f32a293d950111c05673c3fd
[yaffs-website] / web / core / modules / system / src / Tests / Installer / InstallerTest.php
1 <?php
2
3 namespace Drupal\system\Tests\Installer;
4
5 use Drupal\simpletest\InstallerTestBase;
6
7 /**
8  * Tests the interactive installer.
9  *
10  * @group Installer
11  */
12 class InstallerTest extends InstallerTestBase {
13
14   /**
15    * Ensures that the user page is available after installation.
16    */
17   public function testInstaller() {
18     $this->assertUrl('user/1');
19     $this->assertResponse(200);
20     // Confirm that we are logged-in after installation.
21     $this->assertText($this->rootUser->getUsername());
22
23     // Verify that the confirmation message appears.
24     require_once \Drupal::root() . '/core/includes/install.inc';
25     $this->assertRaw(t('Congratulations, you installed @drupal!', [
26       '@drupal' => drupal_install_profile_distribution_name(),
27     ]));
28
29     // Ensure that the timezone is correct for sites under test after installing
30     // interactively.
31     $this->assertEqual($this->config('system.date')->get('timezone.default'), 'Australia/Sydney');
32   }
33
34   /**
35    * Installer step: Select language.
36    */
37   protected function setUpLanguage() {
38     // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets and
39     // metatags as expected to the first page of the installer.
40     $this->assertRaw('core/themes/seven/css/components/buttons.css');
41     $this->assertRaw('<meta charset="utf-8" />');
42
43     // Assert that the expected title is present.
44     $this->assertEqual('Choose language', $this->cssSelect('main h2')[0]);
45
46     parent::setUpLanguage();
47   }
48
49   /**
50    * {@inheritdoc}
51    */
52   protected function setUpProfile() {
53     // Assert that the expected title is present.
54     $this->assertEqual('Select an installation profile', $this->cssSelect('main h2')[0]);
55     $result = $this->xpath('//span[contains(@class, :class) and contains(text(), :text)]', [':class' => 'visually-hidden', ':text' => 'Select an installation profile']);
56     $this->assertEqual(count($result), 1, "Title/Label not displayed when '#title_display' => 'invisible' attribute is set");
57
58     parent::setUpProfile();
59   }
60
61   /**
62    * {@inheritdoc}
63    */
64   protected function setUpSettings() {
65     // Assert that the expected title is present.
66     $this->assertEqual('Database configuration', $this->cssSelect('main h2')[0]);
67
68     parent::setUpSettings();
69   }
70
71   /**
72    * {@inheritdoc}
73    */
74   protected function setUpSite() {
75     // Assert that the expected title is present.
76     $this->assertEqual('Configure site', $this->cssSelect('main h2')[0]);
77
78     parent::setUpSite();
79   }
80
81   /**
82    * {@inheritdoc}
83    */
84   protected function visitInstaller() {
85     parent::visitInstaller();
86
87     // Assert the title is correct and has the title suffix.
88     $this->assertTitle('Choose language | Drupal');
89   }
90
91 }