You are here

public function ConnectionTest::testPrefixArrayOption in Drupal 10

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php \Drupal\KernelTests\Core\Database\ConnectionTest::testPrefixArrayOption()

Tests the prefix connection option in array form.

File

core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php, line 138

Class

ConnectionTest
Tests of the core database system.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testPrefixArrayOption() {
  $connection_info = Database::getConnectionInfo('default');
  $new_connection_info = $connection_info['default'];
  $new_connection_info['prefix'] = [
    'default' => $connection_info['default']['prefix'],
  ];
  Database::addConnectionInfo('default', 'foo', $new_connection_info);
  $this
    ->expectError();
  $foo_connection = Database::getConnection('foo', 'default');
}