3 namespace Drupal\system\Tests\Installer;
5 use Drupal\simpletest\InstallerTestBase;
8 * Tests the interactive installer.
12 class InstallerTest extends InstallerTestBase {
15 * Ensures that the user page is available after installation.
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());
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(),
29 // Ensure that the timezone is correct for sites under test after installing
31 $this->assertEqual($this->config('system.date')->get('timezone.default'), 'Australia/Sydney');
35 * Installer step: Select language.
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" />');
43 // Assert that the expected title is present.
44 $this->assertEqual('Choose language', $this->cssSelect('main h2')[0]);
46 parent::setUpLanguage();
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");
58 parent::setUpProfile();
64 protected function setUpSettings() {
65 // Assert that the expected title is present.
66 $this->assertEqual('Database configuration', $this->cssSelect('main h2')[0]);
68 parent::setUpSettings();
74 protected function setUpSite() {
75 // Assert that the expected title is present.
76 $this->assertEqual('Configure site', $this->cssSelect('main h2')[0]);
84 protected function visitInstaller() {
85 parent::visitInstaller();
87 // Assert the title is correct and has the title suffix.
88 $this->assertTitle('Choose language | Drupal');