Marcelo Marcelo - 1 year ago 62
PHP Question

How to mock the same method in Prophecy so it retruns different response in each of its calls

In pure PHPUnit mocking I can do something like this:



I was not able to do the same thing using Prophecy. Is it possible?

Answer Source

You can use:

$mock->isReady()->willReturn(false, true);

Apparently it's not documented (see because Prophecy is opinionated and knows better than us. Sigh.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download