mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 04:58:28 +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);
|
$wc_order = Mockery::mock(WC_Order::class);
|
||||||
when('wc_get_order')->justReturn($wc_order);
|
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')
|
$this->orderProcessor->shouldReceive('process')
|
||||||
->with($wc_order)
|
->with($wc_order)
|
||||||
->andReturn(true);
|
->andReturn(true);
|
||||||
|
@ -95,6 +101,12 @@ class CreditCardGatewayTest extends TestCase
|
||||||
$wc_order->shouldReceive('get_customer_id')->andReturn(1);
|
$wc_order->shouldReceive('get_customer_id')->andReturn(1);
|
||||||
when('wc_get_order')->justReturn($wc_order);
|
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';
|
$savedCreditCard = 'abc123';
|
||||||
$_POST['saved_credit_card'] = $savedCreditCard;
|
$_POST['saved_credit_card'] = $savedCreditCard;
|
||||||
|
|
||||||
|
|
|
@ -147,9 +147,11 @@ class WcGatewayTest extends TestCase
|
||||||
when('WC')->justReturn($woocommerce);
|
when('WC')->justReturn($woocommerce);
|
||||||
$woocommerce->cart = $cart;
|
$woocommerce->cart = $cart;
|
||||||
$cart->shouldReceive('empty_cart');
|
$cart->shouldReceive('empty_cart');
|
||||||
|
|
||||||
$session = Mockery::mock(\WC_Session::class);
|
$session = Mockery::mock(\WC_Session::class);
|
||||||
$woocommerce->session = $session;
|
$woocommerce->session = $session;
|
||||||
$session->shouldReceive('get');
|
$session->shouldReceive('get');
|
||||||
|
$session->shouldReceive('set');
|
||||||
|
|
||||||
$result = $testee->process_payment($orderId);
|
$result = $testee->process_payment($orderId);
|
||||||
|
|
||||||
|
@ -164,6 +166,12 @@ class WcGatewayTest extends TestCase
|
||||||
|
|
||||||
$testee = $this->createGateway();
|
$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')
|
expect('wc_get_order')
|
||||||
->with($orderId)
|
->with($orderId)
|
||||||
->andReturn(false);
|
->andReturn(false);
|
||||||
|
@ -227,6 +235,7 @@ class WcGatewayTest extends TestCase
|
||||||
$session = Mockery::mock(\WC_Session::class);
|
$session = Mockery::mock(\WC_Session::class);
|
||||||
$woocommerce->session = $session;
|
$woocommerce->session = $session;
|
||||||
$session->shouldReceive('get');
|
$session->shouldReceive('get');
|
||||||
|
$session->shouldReceive('set');
|
||||||
|
|
||||||
$result = $testee->process_payment($orderId);
|
$result = $testee->process_payment($orderId);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue