当模拟方法抛出 `Throwable` 时,对方法的调用不会被记录
作者: BladeMF创建于 2023年4月8日更新于 2026年2月21日
考虑以下代码:
php
$this->prophesize(Publisher::class)
->processChanges($interval)
->shouldBeCalled()
->willThrow(new TypeError())
->getObjectProphecy()
->reveal();
当调用 processChanges 方法时,它会抛出指定的 TypeError,但调用不会被记录。
内容来源: phpspec/prophecy