Reputation: 9255
I am using the Phpunit for unit testing and its mocking framework. I have a mock for a method:
$myProcessor
->expects($this->once())
->method("myMockedMethodName");
I would like to validate one of the arguments passed to it.
For example, my function takes arg1, arg2, arg3. I would like to check only for the arg2.
How to do with PHP mocks?
Upvotes: 2
Views: 243
Reputation: 927
You'd use the with()
method as explained in the docs (https://phpunit.readthedocs.io/en/latest/test-doubles.html#test-doubles-mock-objects-examples-subjecttest2-php)
Upvotes: 4