diff --git a/core/modules/system/src/Tests/Installer/InstallerNotValidDatabaseSettingstest.php b/core/modules/system/src/Tests/Installer/InstallerNotValidDatabaseSettingstest.php index 155ca92..080af39 100644 --- a/core/modules/system/src/Tests/Installer/InstallerNotValidDatabaseSettingstest.php +++ b/core/modules/system/src/Tests/Installer/InstallerNotValidDatabaseSettingstest.php @@ -5,7 +5,7 @@ * Contains \Drupal\system\Tests\Installer\InstallerNotValidDatabaseSettingstest. */ -namespace \Drupal\system\Tests\Installer; +namespace Drupal\system\Tests\Installer; use Drupal\simpletest\InstallerTestBase; @@ -15,6 +15,40 @@ * * @group Installer */ -class InstallerExistingDatabaseSettingsTest extends InstallerTestBase { - -} \ No newline at end of file +class InstallerNotValidDatabaseSettingstest extends InstallerTestBase { + + /** + * {@inheritdoc} + */ + protected function setUp() { + // Pre-configure database credentials in settings.php. + $connection_info = Database::getConnectionInfo(); + unset($connection_info['default']['pdo']); + unset($connection_info['default']['init_commands']); + + $this->settings['databases']['default'] = (object) array( + 'value' => $connection_info, + 'required' => TRUE, + ); + parent::setUp(); + } + + /** + * For testing database failures. + */ + public function testDatabaseMultipleFailure() { + // All database settings should be pre-configured, except password. + $values = $this->parameters['forms']['install_settings_form']; + $driver = $values['driver']; + $edit = array(); + if (isset($values[$driver]['password']) && $values[$driver]['password'] === '') { + $edit = $this->translatePostValues(array( + $driver => array( + 'password' => 'fhjhjj', + ), + )); + } + $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); + } + +}