I'm trying to verify that the passed parameters to a method call are correct. I am using PHPUnit and Mockery.
I want to make sure that not only is a specific method called, but I also want to verify that the passed params have the correct values.
How can I inspect/verify that the $refunder below gets the correct parameter input?
// Code to be tested
$refund = $refunder->refundBooking( $booking, [
’amount’ => $this->getSuggestedRefund( $bookingSettings )
]);
// testing code
$refunder = Mockery::mock( ’Refunder’ );
$refunder
->shouldReceive(’refundBooking’)
->with( WHAT DO I PUT HERE? ) // want to verify that second param has [ ’amount’ => 200 ]
->once();
The link isn't dead, it just has an extra parenthesis at the end.
I'm not allowed to post a link because it's my first day as a member of this site, so I can't paste the working one here. Just click the link above and get rid of the ")" at the end and hit "enter" and you'll see the docs.