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