/** * Checks if the function throws exception. * @param callable * @param string class * @param string message * @return void */ public static function throws($function, $class, $message = NULL) { try { call_user_func($function); self::doFail('Expected exception'); } catch (Exception $e) { Assert::exception($class, $message, $e); } }