Mercurial > hg > isophonics-drupal-site
comparison core/modules/system/src/Tests/Installer/InstallerExistingDatabaseSettingsTest.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\simpletest\InstallerTestBase; | |
6 use Drupal\Core\Database\Database; | |
7 | |
8 /** | |
9 * Tests the installer with an existing settings file with database connection | |
10 * info. | |
11 * | |
12 * @group Installer | |
13 */ | |
14 class InstallerExistingDatabaseSettingsTest extends InstallerTestBase { | |
15 | |
16 /** | |
17 * {@inheritdoc} | |
18 */ | |
19 protected function setUp() { | |
20 // Pre-configure database credentials in settings.php. | |
21 $connection_info = Database::getConnectionInfo(); | |
22 unset($connection_info['default']['pdo']); | |
23 unset($connection_info['default']['init_commands']); | |
24 | |
25 $this->settings['databases']['default'] = (object) [ | |
26 'value' => $connection_info, | |
27 'required' => TRUE, | |
28 ]; | |
29 parent::setUp(); | |
30 } | |
31 | |
32 /** | |
33 * {@inheritdoc} | |
34 * | |
35 * @todo The database settings form is not supposed to appear if settings.php | |
36 * contains a valid database connection already (but e.g. no config | |
37 * directories yet). | |
38 */ | |
39 protected function setUpSettings() { | |
40 // All database settings should be pre-configured, except password. | |
41 $values = $this->parameters['forms']['install_settings_form']; | |
42 $driver = $values['driver']; | |
43 $edit = []; | |
44 if (isset($values[$driver]['password']) && $values[$driver]['password'] !== '') { | |
45 $edit = $this->translatePostValues([ | |
46 $driver => [ | |
47 'password' => $values[$driver]['password'], | |
48 ], | |
49 ]); | |
50 } | |
51 $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); | |
52 } | |
53 | |
54 /** | |
55 * Verifies that installation succeeded. | |
56 */ | |
57 public function testInstaller() { | |
58 $this->assertUrl('user/1'); | |
59 $this->assertResponse(200); | |
60 } | |
61 | |
62 } |