annotate core/modules/system/src/Tests/Installer/InstallerTest.php @ 0:4c8ae668cc8c

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