function InstallerDatabaseErrorMessagesTest::setUpSettings

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php \Drupal\FunctionalTests\Installer\InstallerDatabaseErrorMessagesTest::setUpSettings()
  2. 10 core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php \Drupal\FunctionalTests\Installer\InstallerDatabaseErrorMessagesTest::setUpSettings()
  3. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php \Drupal\FunctionalTests\Installer\InstallerDatabaseErrorMessagesTest::setUpSettings()

Overrides InstallerTestBase::setUpSettings

File

core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php, line 22

Class

InstallerDatabaseErrorMessagesTest
Tests the installer with database errors.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function setUpSettings() {
    // We are creating a table here to force an error in the installer because
    // it will try and create the drupal_install_test table as this is part of
    // the standard database tests performed by the installer in
    // Drupal\Core\Database\Install\Tasks.
    $spec = [
        'fields' => [
            'id' => [
                'type' => 'int',
                'not null' => TRUE,
            ],
        ],
        'primary key' => [
            'id',
        ],
    ];
    Database::getConnection('default')->schema()
        ->createTable('drupal_install_test', $spec);
    parent::setUpSettings();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.