3 namespace Drupal\FunctionalTests\Installer;
5 use Drupal\Core\DrupalKernel;
6 use Drupal\Core\Database\Database;
7 use Symfony\Component\HttpFoundation\Request;
10 * Tests the installer with an existing settings file but no install profile.
14 class InstallerExistingSettingsNoProfileTest extends InstallerTestBase {
19 * Configures a preexisting settings.php file without an install_profile
20 * setting before invoking the interactive installer.
22 protected function prepareEnvironment() {
23 parent::prepareEnvironment();
25 // Pre-configure hash salt.
26 // Any string is valid, so simply use the class name of this test.
27 $this->settings['settings']['hash_salt'] = (object) [
32 // Pre-configure database credentials.
33 $connection_info = Database::getConnectionInfo();
34 unset($connection_info['default']['pdo']);
35 unset($connection_info['default']['init_commands']);
37 $this->settings['databases']['default'] = (object) [
38 'value' => $connection_info,
42 // Pre-configure config directories.
43 $this->settings['config_directories'] = [
44 CONFIG_SYNC_DIRECTORY => (object) [
45 'value' => DrupalKernel::findSitePath(Request::createFromGlobals()) . '/files/config_sync',
49 mkdir($this->settings['config_directories'][CONFIG_SYNC_DIRECTORY]->value, 0777, TRUE);
55 protected function setUpSettings() {
56 // This step should not appear, since settings.php is fully configured
61 * Verifies that installation succeeded.
63 public function testInstaller() {
64 $this->assertUrl('user/1');
65 $this->assertResponse(200);
66 $this->assertEqual('testing', \Drupal::installProfile());