annotate core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php @ 19:fa3358dc1485 tip

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