I am using PHPUnit for my unit tests I am using a mock object to test if a method is called with the correct parameters. This works fine when I just want to do this once.
$logMock = $this->getMockBuilder('Logger')
->disableOriginalConstructor()
->getMock();
//check if it updates the correct record
$logMock->expects($this->exactly(1))
->method('updateLog')
->with(456, 'some status');
Now I have the situation that I want to test if the updateLog is called a second time (with different parameters). I don’t see how I can do this with the ‘with’ method.
Does anybody have a suggestion?
I don’t know your mocking framework. Usually you just create another expectation though. I assume that should work with this framework as well.
Edit
It seems that the PHPUnit framework doesn’t support multiple different expectations on the same method. According to this site you have to use the index functionality.
It would then look like this