/** * Tests to ensure that a database exception is thrown when the engine doesn't exist. */ public function testGetInstanceException() { $engineName = 'DoesNotExist'; $this->setExpectedException('\\Queryer\\Exception\\DatabaseException', sprintf('The database driver %s was not found (attempted to autoload "%s").', htmlspecialchars(ucfirst(strtolower($engineName))), htmlspecialchars(Database::getDriverClassName($engineName))), DatabaseException::DRIVER_NOT_FOUND); // Tell it to use a nonexistent engine. Database::setEngineName($engineName); // Then it should throw an Exception. Database::getInstance(); }