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