作者:李劲松在科岛每晚包夜 | 来源:互联网 | 2022-12-22 11:57
1> Nikita U...:
您可以使用willReturnOnConsecutiveCalls
方法
$mock
->expects($this->exactly(2))
->method('testMethod')
->willReturnOnConsecutiveCalls(true, false);
替代(对于phpunit <4):
$mock
->expects($this->exactly(2))
->method('testMethod')
->will($this->onConsecutiveCalls(true, false));