我在RSpec中进行了以下测试:
it { is_expected.to respond_to(:dock).with(1).argument }
我需要使用PHPSpec复制此测试。我的代码如下:
function it_should_dock_a_bike()
{
$bike = new \Bike();
$this->dock($bike)->shouldReturnAnInstanceOf('Bike');
}
此代码有效,当我排除$ bike参数时,它的确失败了,但是有没有比RSpec中的示例更好的显式编写测试的方法了?
答案 0 :(得分:1)
$this->dock(Argument::any())->shouldReturnAnInstanceOf(Bike::class);
是您要寻找的