You are here

public function InstallerTest::testInstaller in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php \Drupal\FunctionalTests\Installer\InstallerTest::testInstaller()
  2. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php \Drupal\FunctionalTests\Installer\InstallerTest::testInstaller()

Ensures that the user page is available after installation.

File

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

Class

InstallerTest
Tests the interactive installer.

Namespace

Drupal\FunctionalTests\Installer

Code

public function testInstaller() {
  $this
    ->assertNotNull(\Drupal::state()
    ->get('system.css_js_query_string'), 'The dummy query string should be set during install');
  $this
    ->assertSession()
    ->addressEquals('user/1');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Confirm that we are logged-in after installation.
  $this
    ->assertSession()
    ->pageTextContains($this->rootUser
    ->getAccountName());

  // Verify that the confirmation message appears.
  require_once $this->root . '/core/includes/install.inc';
  $this
    ->assertSession()
    ->pageTextContains('Congratulations, you installed Drupal!');

  // Ensure that the timezone is correct for sites under test after installing
  // interactively.
  $this
    ->assertEquals('Australia/Sydney', $this
    ->config('system.date')
    ->get('timezone.default'));

  // Ensure the profile has a weight of 1000.
  $module_extension_list = \Drupal::service('extension.list.module');
  $extensions = $module_extension_list
    ->getList();
  $this
    ->assertArrayHasKey('testing', $extensions);
  $this
    ->assertEquals(1000, $extensions['testing']->weight);

  // Ensures that router is not rebuilt unnecessarily during the install.
  $this
    ->assertSame(1, \Drupal::service('core.performance.test.recorder')
    ->getCount('event', RoutingEvents::FINISHED));
}