function InstallerTestBase::setUp
Same name in other branches
- 9 core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php \Drupal\FunctionalTests\Installer\InstallerTestBase::setUp()
- 8.9.x core/modules/simpletest/src/InstallerTestBase.php \Drupal\simpletest\InstallerTestBase::setUp()
- 8.9.x core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php \Drupal\FunctionalTests\Installer\InstallerTestBase::setUp()
- 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php \Drupal\FunctionalTests\Installer\InstallerTestBase::setUp()
Overrides BrowserTestBase::setUp
1 method overrides InstallerTestBase::setUp()
- StandardRecipeInstallTest::setUp in core/
tests/ Drupal/ FunctionalTests/ Core/ Recipe/ StandardRecipeInstallTest.php
File
-
core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerTestBase.php, line 159
Class
- InstallerTestBase
- Base class for testing the interactive installer.
Namespace
Drupal\FunctionalTests\InstallerCode
protected function setUp() : void {
parent::setUp();
$this->visitInstaller();
// Select language.
$this->setUpLanguage();
// Select profile.
$this->setUpProfile();
// Address the requirements problem screen, if any.
$this->setUpRequirementsProblem();
// Configure settings.
$this->setUpSettings();
// @todo Allow test classes based on this class to act on further installer
// screens.
// Configure site.
$this->setUpSite();
if ($this->isInstalled) {
// Import new settings.php written by the installer.
$request = Request::createFromGlobals();
$class_loader = (require $this->container
->getParameter('app.root') . '/autoload.php');
Settings::initialize($this->container
->getParameter('app.root'), DrupalKernel::findSitePath($request), $class_loader);
// After writing settings.php, the installer removes write permissions
// from the site directory. To allow drupal_generate_test_ua() to write
// a file containing the private key for drupal_valid_test_ua(), the site
// directory has to be writable.
// BrowserTestBase::tearDown() will delete the entire test site directory.
// Not using File API; a potential error must trigger a PHP warning.
chmod($this->container
->getParameter('app.root') . '/' . $this->siteDirectory, 0777);
$this->kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod', FALSE);
$this->kernel
->boot();
$this->kernel
->preHandle($request);
$this->container = $this->kernel
->getContainer();
// Manually configure the test mail collector implementation to prevent
// tests from sending out emails and collect them in state instead.
$this->container
->get('config.factory')
->getEditable('system.mail')
->set('interface.default', 'test_mail_collector')
->set('mailer_dsn', [
'scheme' => 'null',
'host' => 'null',
'user' => NULL,
'password' => NULL,
'port' => NULL,
'options' => [],
])
->save();
$this->installDefaultThemeFromClassProperty($this->container);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.