function ConnectionTest::testPrefixArrayOption
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php \Drupal\KernelTests\Core\Database\ConnectionTest::testPrefixArrayOption()
- 11.x 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 137
Class
- ConnectionTest
- Tests of the core database system.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testPrefixArrayOption() : void {
$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->expectException(\AssertionError::class);
$foo_connection = Database::getConnection('foo', 'default');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.