InstallerExistingSettingsTest.php in Drupal 9
File
core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php
View source
<?php
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
class InstallerExistingSettingsTest extends InstallerTestBase {
protected $defaultTheme = 'stark';
protected function prepareEnvironment() {
parent::prepareEnvironment();
$this->settings['settings']['hash_salt'] = (object) [
'value' => __CLASS__,
'required' => TRUE,
];
$connection_info = Database::getConnectionInfo();
unset($connection_info['default']['pdo']);
unset($connection_info['default']['init_commands']);
$this->settings['databases']['default'] = (object) [
'value' => $connection_info,
'required' => TRUE,
];
$site_path = DrupalKernel::findSitePath(Request::createFromGlobals());
$this->settings['settings']['config_sync_directory'] = (object) [
'value' => $site_path . '/files/config_sync',
'required' => TRUE,
];
mkdir($this->settings['settings']['config_sync_directory']->value, 0777, TRUE);
}
protected function visitInstaller() {
$this
->drupalGet($GLOBALS['base_url']);
$this
->assertSame([], Database::getConnection()
->schema()
->findTables('%'));
$this
->assertSession()
->addressEquals($GLOBALS['base_url'] . '/core/install.php');
}
protected function setUpSettings() {
}
public function testInstaller() {
$this
->assertSession()
->addressEquals('user/1');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertEquals('testing', \Drupal::installProfile());
}
}