function InstallerTest::setUpLanguage

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php \Drupal\FunctionalTests\Installer\InstallerTest::setUpLanguage()
  2. 10 core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php \Drupal\FunctionalTests\Installer\InstallerTest::setUpLanguage()
  3. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php \Drupal\FunctionalTests\Installer\InstallerTest::setUpLanguage()
  4. 8.9.x core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php \Drupal\FunctionalTests\Installer\InstallerTest::setUpLanguage()

Installer step: Select language.

Overrides InstallerTestBase::setUpLanguage

File

core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php, line 60

Class

InstallerTest
Tests the interactive installer.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function setUpLanguage() : void {
  // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets and
  // metatags as expected to the first page of the installer.
  $this->assertSession()
    ->responseContains("css/components/button.css");
  $this->assertSession()
    ->responseContains('<meta charset="utf-8" />');
  // Test that the default installer theme is being used.
  $this->assertSession()
    ->responseContains("default_admin/css/theme/install-page.css");
  // Preloaded fonts must be linked relative to the site root, not relative to
  // the installer's front controller, otherwise the browser requests them
  // from index.php.
  // @see \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processAttachments()
  $preloaded_font = $this->assertSession()
    ->elementExists('xpath', '//link[@rel="preload"][@as="font"]');
  $this->assertStringNotContainsString('install.php', $preloaded_font->getAttribute('href'));
  $this->assertStringEndsWith('/core/themes/default_admin/font/inter.woff2', $preloaded_font->getAttribute('href'));
  // Assert that the expected title is present.
  $this->assertEquals('Choose language', $this->cssSelect('main h2')[0]
    ->getText());
  parent::setUpLanguage();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.