/** * Creates a RunnableException, given a previously raised exception. This * corresponds to an exception thrown during regular execution of the test * runner, and is linked to the originating spec. * * @param \Exception $exception The exception thrown during a spec */ public function __construct(\Exception $exception) { parent::__construct($exception->getMessage(), $exception->getCode(), $exception); $this->file = $exception->getFile(); $this->line = $exception->getLine(); $this->type = get_class($exception); }
/** * Creates an ErrorException, given the same parameters used by an error * handler used with set_error_handler(). The class only handles the default * PHP constant error levels. * * @param int $level The error level corresponding to the PHP error * @param string $string Error message itself * @param string $file The name of the file from which the error was raised * @param int $line The line number from which the error was raised */ public function __construct($level, $string, $file = null, $line = null) { parent::__construct($string, 0); $this->file = $file; $this->line = $line; $this->type = self::$errorConstants[$level]; }