InstallerDatabaseErrorMessagesTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 $defaultTheme = 'stark';
  14. /**
  15. * {@inheritdoc}
  16. */
  17. protected function setUpSettings() {
  18. // We are creating a table here to force an error in the installer because
  19. // it will try and create the drupal_install_test table as this is part of
  20. // the standard database tests performed by the installer in
  21. // Drupal\Core\Database\Install\Tasks.
  22. Database::getConnection('default')->query('CREATE TABLE {drupal_install_test} (id int NOT NULL PRIMARY KEY)');
  23. parent::setUpSettings();
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. protected function setUpSite() {
  29. // This step should not appear as we had a failure on the settings screen.
  30. }
  31. /**
  32. * Verifies that the error message in the settings step is correct.
  33. */
  34. public function testSetUpSettingsErrorMessage() {
  35. $this->assertRaw('<ul><li>Failed to <strong>CREATE</strong> a test table');
  36. }
  37. }