May 6, 2015
0
Level 10
Mockery : nested method?
I am writing some tests for a Stripe API implementation. A Stripe Refund is made like this via their API:
$ch = \Stripe\Charge::retrieve( $chargeId );
$re = $ch->refunds->create();
I am using Mockery, but I don't know how to mock the refunds->create method?
The following will not work (I get a "Trying to get property of non-object" error):
$charge = Mockery::mock( 'Stripe\Charge' );
$charge->shouldReceive( 'refunds->create' );
Please or to participate in this conversation.