comparison core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 namespace Drupal\FunctionalTests\Installer;
4
5 use Drupal\Core\DrupalKernel;
6 use Drupal\Core\Database\Database;
7 use Symfony\Component\HttpFoundation\Request;
8
9 /**
10 * Tests the installer with an existing settings file but no install profile.
11 *
12 * @group Installer
13 */
14 class InstallerExistingSettingsNoProfileTest extends InstallerTestBase {
15
16 /**
17 * {@inheritdoc}
18 *
19 * Configures a preexisting settings.php file without an install_profile
20 * setting before invoking the interactive installer.
21 */
22 protected function prepareEnvironment() {
23 parent::prepareEnvironment();
24
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) [
28 'value' => __CLASS__,
29 'required' => TRUE,
30 ];
31
32 // Pre-configure database credentials.
33 $connection_info = Database::getConnectionInfo();
34 unset($connection_info['default']['pdo']);
35 unset($connection_info['default']['init_commands']);
36
37 $this->settings['databases']['default'] = (object) [
38 'value' => $connection_info,
39 'required' => TRUE,
40 ];
41
42 // Pre-configure config directories.
43 $this->settings['config_directories'] = [
44 CONFIG_SYNC_DIRECTORY => (object) [
45 'value' => DrupalKernel::findSitePath(Request::createFromGlobals()) . '/files/config_sync',
46 'required' => TRUE,
47 ],
48 ];
49 mkdir($this->settings['config_directories'][CONFIG_SYNC_DIRECTORY]->value, 0777, TRUE);
50 }
51
52 /**
53 * {@inheritdoc}
54 */
55 protected function setUpSettings() {
56 // This step should not appear, since settings.php is fully configured
57 // already.
58 }
59
60 /**
61 * Verifies that installation succeeded.
62 */
63 public function testInstaller() {
64 $this->assertUrl('user/1');
65 $this->assertResponse(200);
66 $this->assertEqual('testing', \Drupal::installProfile());
67 }
68
69 }