public sayHelloAndThrow ( boolean $throwException ) : string | ||
$throwException | boolean | |
return | string |
public function sayHelloAndThrow($throwException)
{
if ($throwException) {
throw new \Exception();
}
return 'Hello';
}
/** * @test */ public function adviceRecoversFromException() { $targetClass = new Fixtures\TargetClass01(); try { $targetClass->sayHelloAndThrow(true); } catch (\Exception $exception) { } $this->assertSame('Hello World', $targetClass->sayHelloAndThrow(false)); }