how test that the connection works in Doctrine 2?

Do not use the EntityManager directly. You can instead use following to check the connection parameters:

try {
    $entityManager->getConnection()->connect();
} catch (\Exception $e) {
    // failed to connect
}

That's sadly the only real way to check if something went wrong, since the exception type changes depending on the driver you use.

For the other exception (the view-related one) you simply have to adjust your view scripts path. I suggest you to keep the skeleton application module enabled so that the default layout is always there: you can override it at any time.


You can use.

$cnx = $this->getDoctrine()->getConnection();

$cnx->isConnected() ? 
  'Connected' : 
  'not connected';