public function testConnectionExcpetion() { $isCatched = false; try { $mysqlHandler = new MySQLHandler('', '', '', 'a fail host'); $mysqlHandler->getConnection(); } catch (PDOException $e) { echo $e->getMessage(); $isCatched = true; } $this->assertTrue($isCatched); }