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