Following test passes, even though notThrowingFunction() does not throw. Could it be a bug?
$this
->given(new SomeEvent())
->when(fn (MyAggregate $aggregate) => $aggregate->notThrowingFunction())
->then()
->expectsException(\LogicException::class);
I noticed that handleException() is only called when exception actually occurs.
|
if ($this->expectedException) { |
Note that using phpunit's TestCase::expectException() properly fails test if exception is not thrown. Maybe I am not understanding the difference between TestCase::expectException() and AggregateRootTestCase::expectsException() properly.