annotate core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php @ 5:12f9dff5fda9 tip

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