You are here

protected function InstallerTranslationTest::setUpSettings in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php \Drupal\FunctionalTests\Installer\InstallerTranslationTest::setUpSettings()
  2. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php \Drupal\FunctionalTests\Installer\InstallerTranslationTest::setUpSettings()

Installer step: Configure settings.

Overrides InstallerTestBase::setUpSettings

File

core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php, line 50

Class

InstallerTranslationTest
Installs Drupal in German and checks resulting site.

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();

  // Ensure that the error message translation is working.
  // cSpell:disable
  $this
    ->assertSession()
    ->responseContains('Beheben Sie alle Probleme unten, um die Installation fortzusetzen. Informationen zur Konfiguration der Datenbankserver finden Sie in der <a href="https://www.drupal.org/docs/installing-drupal">Installationshandbuch</a>, oder kontaktieren Sie Ihren Hosting-Anbieter.');
  $this
    ->assertSession()
    ->responseContains('<strong>CREATE</strong> ein Test-Tabelle auf Ihrem Datenbankserver mit dem Befehl <em class="placeholder">CREATE TABLE {drupal_install_test} (id int NOT NULL PRIMARY KEY)</em> fehlgeschlagen.');

  // cSpell:enable
  // Now do it successfully.
  Database::getConnection('default')
    ->schema()
    ->dropTable('drupal_install_test');
  parent::setUpSettings();
}