Questions regarding PHPUnit mock feature

Posted by Andree on Stack Overflow See other posts from Stack Overflow or by Andree
Published on 2010-06-15T16:27:39Z Indexed on 2010/06/15 16:32 UTC
Read the original article Hit count: 257

Filed under:
|
|

Can someone provide me a reference to a good PHPUnit mock guide? The one in the official documentation doesn't seem to be detailed enough.

I need to know about the following:

1) How to expect multiple calls to a mock object's method, but each return a different sets of value?

$tableMock->expects($this->exactly(2))
    ->method('find')
    ->will($this->returnValue(2)); // I need the second call to return different value

2) How to expect a call to a mock object's method with multiple parameters?

© Stack Overflow or respective owner

Related posts about php

Related posts about mocking