PHPSpec2\Mocker\MockExpectation::willThrow PHP Method

willThrow() public method

public willThrow ( $exception, $message = '' )
    public function willThrow($exception, $message = '')
    {
        if ($exception instanceof \Exception) {
            $message = $exception->getMessage();
            $exception = get_class($exception);
        }
        $this->mocker->willThrow($this->getExpectation(), $exception, $message);
        return $this;
    }