try {
$this->getContainer()->get('doctrine')->getManager()->getConnection()->connect();
} catch (\Exception $e) {
- $fulfilled = false;
- $status = '<error>ERROR!</error>';
- $help = 'Can\'t connect to the database: '.$e->getMessage();
+ if (false === strpos($e->getMessage(), "Unknown database")) {
+ $fulfilled = false;
+ $status = '<error>ERROR!</error>';
+ $help = 'Can\'t connect to the database: '.$e->getMessage();
+ }
}
$rows[] = [$label, $status, $help];
}
// custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite
- if ('sqlite' == $schemaManager->getDatabasePlatform()->getName()) {
+ if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) {
$params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams();
if (isset($params['path']) && file_exists($params['path'])) {
public function testRunInstallCommandWithDatabaseRemoved()
{
+ // skipped SQLite check when database is removed because while testing for the connection,
+ // the driver will create the file (so the database) before testing if database exist
+ if ($this->getClient()->getContainer()->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
+ $this->markTestSkipped('SQLite spotted: can\'t test with database removed.');
+ }
+
$application = new Application($this->getClient()->getKernel());
$application->add(new DropDatabaseDoctrineCommand());