public function DatabaseFactoryTest::testGetSadUnsetAlias in MongoDB 8.2
Test referencing an alias not present in settings.
File
- modules/
mongodb/ tests/ src/ Kernel/ DatabaseFactoryTest.php, line 62
Class
- DatabaseFactoryTest
- Tests the DatabaseFactory.
Namespace
Drupal\Tests\mongodb\KernelCode
public function testGetSadUnsetAlias() {
try {
$this->databaseFactory
->get(static::DB_UNSET_ALIAS);
$this
->fail('Should not have returned a value for an unset database alias.');
} catch (\InvalidArgumentException $e) {
$this
->assertTrue(TRUE, 'Throws expected exception for unset database alias.');
} catch (\Exception $e) {
$this
->fail(strtr('Unexpected exception thrown for unset alias: @exception', [
'@exception' => $e
->getMessage(),
]));
}
}