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