mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Fix phpunit
This commit is contained in:
parent
14d102015d
commit
c39b03bcc9
2 changed files with 21 additions and 0 deletions
|
@ -78,6 +78,12 @@ class CreditCardGatewayTest extends TestCase
|
|||
$wc_order = Mockery::mock(WC_Order::class);
|
||||
when('wc_get_order')->justReturn($wc_order);
|
||||
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$session = Mockery::mock(\WC_Session::class);
|
||||
when('WC')->justReturn($woocommerce);
|
||||
$woocommerce->session = $session;
|
||||
$session->shouldReceive('set')->andReturn([]);
|
||||
|
||||
$this->orderProcessor->shouldReceive('process')
|
||||
->with($wc_order)
|
||||
->andReturn(true);
|
||||
|
@ -95,6 +101,12 @@ class CreditCardGatewayTest extends TestCase
|
|||
$wc_order->shouldReceive('get_customer_id')->andReturn(1);
|
||||
when('wc_get_order')->justReturn($wc_order);
|
||||
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$session = Mockery::mock(\WC_Session::class);
|
||||
when('WC')->justReturn($woocommerce);
|
||||
$woocommerce->session = $session;
|
||||
$session->shouldReceive('set')->andReturn([]);
|
||||
|
||||
$savedCreditCard = 'abc123';
|
||||
$_POST['saved_credit_card'] = $savedCreditCard;
|
||||
|
||||
|
|
|
@ -147,9 +147,11 @@ class WcGatewayTest extends TestCase
|
|||
when('WC')->justReturn($woocommerce);
|
||||
$woocommerce->cart = $cart;
|
||||
$cart->shouldReceive('empty_cart');
|
||||
|
||||
$session = Mockery::mock(\WC_Session::class);
|
||||
$woocommerce->session = $session;
|
||||
$session->shouldReceive('get');
|
||||
$session->shouldReceive('set');
|
||||
|
||||
$result = $testee->process_payment($orderId);
|
||||
|
||||
|
@ -164,6 +166,12 @@ class WcGatewayTest extends TestCase
|
|||
|
||||
$testee = $this->createGateway();
|
||||
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$session = Mockery::mock(\WC_Session::class);
|
||||
when('WC')->justReturn($woocommerce);
|
||||
$woocommerce->session = $session;
|
||||
$session->shouldReceive('set')->andReturn([]);
|
||||
|
||||
expect('wc_get_order')
|
||||
->with($orderId)
|
||||
->andReturn(false);
|
||||
|
@ -227,6 +235,7 @@ class WcGatewayTest extends TestCase
|
|||
$session = Mockery::mock(\WC_Session::class);
|
||||
$woocommerce->session = $session;
|
||||
$session->shouldReceive('get');
|
||||
$session->shouldReceive('set');
|
||||
|
||||
$result = $testee->process_payment($orderId);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue