For the code below,
$mockObject->expects($this->at(0))
->method(\'search\')
->with($searchConfig)
->will($this-&g
You can use Mockery for it
Say I have a code
$productValidator = app(ProductValidator:class)->setProduct($productIn);
That would be the test code
use Mockery;
...
$productValidator
->shouldReceive('setProduct')->once()
->with(Mockery::type(Product::class))
->with(Mockery::on(function($productIn) use ($productId) {
return $productIn->id === $productId;
}))
->andReturn($productValidator);
Tested on phpunit "version": "8.5.8"