function FunctionalTestSetupTrait::initUserSession
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::initUserSession()
- 10 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::initUserSession()
- 11.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::initUserSession()
Initializes user 1 for the site to be installed.
3 calls to FunctionalTestSetupTrait::initUserSession()
- BrowserTestBase::installDrupal in core/
tests/ Drupal/ Tests/ BrowserTestBase.php - Installs Drupal into the Simpletest site.
- TestSiteInstallCommand::installDrupal in core/
tests/ Drupal/ TestSite/ Commands/ TestSiteInstallCommand.php - Installs Drupal into the test site.
- UpdatePathTestBase::installDrupal in core/
tests/ Drupal/ FunctionalTests/ Update/ UpdatePathTestBase.php - Installs Drupal into the Simpletest site.
File
-
core/
lib/ Drupal/ Core/ Test/ FunctionalTestSetupTrait.php, line 366
Class
- FunctionalTestSetupTrait
- Defines a trait for shared functional test setup functionality.
Namespace
Drupal\Core\TestCode
protected function initUserSession() {
$password = $this->randomMachineName();
// Define information about the user 1 account.
$this->rootUser = new UserSession([
'uid' => 1,
'name' => 'admin',
'mail' => 'admin@example.com',
'pass_raw' => $password,
'passRaw' => $password,
'timezone' => date_default_timezone_get(),
]);
// The child site derives its session name from the database prefix when
// running web tests.
$this->generateSessionName($this->databasePrefix);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.