3 namespace Drupal\FunctionalTests\Installer;
6 * Tests the interactive installer.
10 class InstallerTest extends InstallerTestBase {
13 * Ensures that the user page is available after installation.
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());
21 // Verify that the confirmation message appears.
22 require_once $this->root . '/core/includes/install.inc';
23 $this->assertRaw(t('Congratulations, you installed @drupal!', [
24 '@drupal' => drupal_install_profile_distribution_name(),
27 // Ensure that the timezone is correct for sites under test after installing
29 $this->assertEqual($this->config('system.date')->get('timezone.default'), 'Australia/Sydney');
33 * Installer step: Select language.
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" />');
41 // Assert that the expected title is present.
42 $this->assertEqual('Choose language', $this->cssSelect('main h2')[0]->getText());
44 parent::setUpLanguage();
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");
56 parent::setUpProfile();
62 protected function setUpSettings() {
63 // Assert that the expected title is present.
64 $this->assertEqual('Database configuration', $this->cssSelect('main h2')[0]->getText());
66 parent::setUpSettings();
72 protected function setUpSite() {
73 // Assert that the expected title is present.
74 $this->assertEqual('Configure site', $this->cssSelect('main h2')[0]->getText());
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'));
88 protected function visitInstaller() {
89 parent::visitInstaller();
91 // Assert the title is correct and has the title suffix.
92 $this->assertTitle('Choose language | Drupal');