Skip to content

Commit

Permalink
[README] explain how to return different values for the same call
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Jun 21, 2019
1 parent 3660b2e commit 7223e88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,17 @@ $user->setName('everzet')->will(function ($args) use ($user) {
And now it doesn't matter how many times or in which order your methods are called.
What matters is their behaviors and how well you faked it.

Note: If the method is called several times, you can use the following syntax to return different
values for each call:

```php
$prophecy->read('123')->willReturn(1, 2, 3);
```

This feature is actually not recommended for most cases. Relying on the order of
calls for the same arguments tends to make test fragile, as adding one more call
can break everything.

#### Arguments wildcarding

The previous example is awesome (at least I hope it is for you), but that's not
Expand Down

0 comments on commit 7223e88

Please sign in to comment.