Skip to content

Commit

Permalink
Make sure the functions are mocked to expect payment upfront
Browse files Browse the repository at this point in the history
  • Loading branch information
james-allan committed Feb 23, 2024
1 parent ac9b98b commit 25880c5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/phpunit/test-class-wc-stripe-upe-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -1712,11 +1712,19 @@ public function test_pre_order_payment_is_successful() {
$payment_intent_mock['charges']['data'][0]['payment_method_details'] = $payment_method_mock;

// Mock order has pre-order product.
$this->mock_gateway->expects( $this->once() )
$this->mock_gateway->expects( $this->any() )
->method( 'has_pre_order' )
->with( $order_id )
->will( $this->returnValue( true ) );

$this->mock_gateway->expects( $this->once() )
->method( 'is_pre_order_item_in_cart' )
->will( $this->returnValue( true ) );

$this->mock_gateway->expects( $this->once() )
->method( 'is_pre_order_product_charged_upfront' )
->will( $this->returnValue( true ) );

$this->mock_gateway->expects( $this->once() )
->method( 'stripe_request' )
->with( "payment_intents/$payment_intent_id?expand[]=payment_method" )
Expand Down

0 comments on commit 25880c5

Please sign in to comment.