草庐IT

atLeastOnce

全部标签

php - 用具体值模拟 atLeastOnce,其余的不重要

问题在PHP中,但适用于使用xUnit框架的任何语言。我想要一个mock,需要140次调用jump方法。我需要验证,至少一次有一个以500作为参数的调用。我不在乎是否所有调用都是500,但我至少需要一个调用了500的调用。$mock=$this->getMock('Trampoline',['jump']);$mock->expects($this->atLeastOnce())->method('jump')->with($this->equalTo(500))->will($this->returnValue(true));$sportsman->setTramploine($mo