【发布时间】:2021-01-14 13:16:28
【问题描述】:
现在使用 PHP Prophecy。我有两个代码示例: 一:
$aProphecy = $this->prophesize(A::class);
$aProphecy->someMethod()->willReturn([]);
//now can be used:
$aProphecy->reveal();
两个
$aProphecy = $this->prophesize(A::class);
$aProphecy->reveal();
$aProphecy->someMethod()->willReturn([]);
我不明白哪个是正确的方法,为什么?
【问题讨论】: