/** * @param \Exception The expected thrown Exception * @throws AssertionFailedException If thrown exception is not $exception */ public function thrown(\Exception $exception) { if (!$this->call->thrown()) { throw new AssertionFailedException($this->methodCall . ' did not throw ' . ValuePrinter::serialize($exception) . "\n" . ' No exception was thrown.'); } if (get_class($exception) != get_class($this->call->thrown()) || $exception->getMessage() != $this->call->thrown()->getMessage()) { throw new AssertionFailedException($this->methodCall . ' did not throw ' . ValuePrinter::serialize($exception) . "\n" . ' The thrown exception was ' . ValuePrinter::serialize($this->call->thrown())); } }
private function printResult(Call $call) { if ($call->thrown()) { $result = '!! ' . $this->toString($call->thrown()); return $result; } else { $result = '-> ' . $this->toString($call->returned()); return $result; } }