function SuperUserAccessInstallTest::testInstalled

Same name and namespace in other branches
  1. 10 core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php \Drupal\FunctionalTests\Installer\SuperUserAccessInstallTest::testInstalled()

Confirms that the installation succeeded.

@dataProvider getInstallTests

File

core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php, line 76

Class

SuperUserAccessInstallTest
Tests superuser access and the installer.

Namespace

Drupal\FunctionalTests\Installer

Code

public function testInstalled(bool $expected_runtime_has_permission, bool $expected_no_access_message, array $expected_roles, string $install_code, bool $super_user_policy) : void {
  $user = User::load(1);
  $this->assertSame($expected_runtime_has_permission, $user->hasPermission('administer software updates'));
  $this->assertTrue(\Drupal::state()->get('admin_permission_in_installer'));
  $message = sprintf(static::NO_ACCESS_MESSAGE, $this->rootUser
    ->getDisplayName());
  if ($expected_no_access_message) {
    $this->assertSession()
      ->pageTextContains($message);
  }
  else {
    $this->assertSession()
      ->pageTextNotContains($message);
  }
  $this->assertSame($expected_roles, $user->getRoles(TRUE));
}

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