You are here

public function InstallerWithTablePrefixArrayTest::testInstall in Drupal 9

Ensures that the status report raises the warning after installation.

File

core/tests/Drupal/FunctionalTests/Installer/InstallerWithTablePrefixArrayTest.php, line 20

Class

InstallerWithTablePrefixArrayTest
Tests the interactive installer with deprecated table prefix array.

Namespace

Drupal\FunctionalTests\Installer

Code

public function testInstall() : void {
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertSession()
    ->pageTextNotContains("There is at least one database entry in the \$database array in settings.php that has a 'prefix' value in the format of an array. Per-table prefixes are no longer supported.");

  // Add a database with a multi-entry 'prefix' array.
  $settings['databases']['test_fu']['default'] = (object) [
    'value' => [
      'database' => 'drupal_db',
      'prefix' => [
        'default' => 'foo',
        'other_table' => 'qux',
      ],
      'host' => 'localhost',
      'namespace' => 'Drupal\\Core\\Database\\Driver\\sqlite',
      'driver' => 'sqlite',
    ],
    'required' => TRUE,
  ];
  $this
    ->writeSettings($settings);
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertSession()
    ->pageTextContains("There is at least one database entry in the \$database array in settings.php that has a 'prefix' value in the format of an array. Per-table prefixes are no longer supported.");
}