function() use ($message) { throw new \PDOException($message); } ) ); \ORM::setDb($pdo); try { $model::findMany(); $this->fail('Exception was not thrown'); } catch(\Exception $e) { expect($e instanceof \PDOException)->false(); expect($e->getMessage())->equals($message); } // Remove the DB stub \ORM::setDb(null); } }