【发布时间】:2020-06-10 05:53:38
【问题描述】:
我在模拟上使用with 方法,以断言该方法是以对象作为参数调用的
Mockery::mock(PaymentRepository::class)
->shouldReceive('removeTripPayments')
->with($trip)
->mock();
失败了,我仍然不知道为什么,但我最关心的是这是否是检查它的正确方法以及是否有可能显示如何预期的参数是不同的从给定的。
1) PaymentServiceTest::test_removing_payments
Mockery\Exception\NoMatchingExpectationException: No matching handler found for Mockery_0_PaymentRepository::removeTripPayments(object(Trip)). Either the method was unexpected or its arguments matched no expected argument list for this method
Objects: ( array (
'MyNamespace\Trip' =>
array (
'class' => 'MyNamespace\\Trip',
'properties' =>
array (
),
),
))
【问题讨论】: