public function seeExceptionThrown($exceptionMessage, $function) { try { $function(); return false; } catch (Exception $e) { if ($e->getMessage() == $exceptionMessage) { return true; } return false; } }