InstallerDatabaseErrorMessagesTest.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Drupal\FunctionalTests\Installer;
  3. use Drupal\Core\Database\Database;
  4. /**
  5. * Tests the installer with database errors.
  6. *
  7. * @group Installer
  8. */
  9. class InstallerDatabaseErrorMessagesTest extends InstallerTestBase {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. protected function setUpSettings() {
  14. // We are creating a table here to force an error in the installer because
  15. // it will try and create the drupal_install_test table as this is part of
  16. // the standard database tests performed by the installer in
  17. // Drupal\Core\Database\Install\Tasks.
  18. Database::getConnection('default')->query('CREATE TABLE {drupal_install_test} (id int NULL)');
  19. parent::setUpSettings();
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. protected function setUpSite() {
  25. // This step should not appear as we had a failure on the settings screen.
  26. }
  27. /**
  28. * Verifies that the error message in the settings step is correct.
  29. */
  30. public function testSetUpSettingsErrorMessage() {
  31. $this->assertRaw('<ul><li>Failed to <strong>CREATE</strong> a test table');
  32. }
  33. }