mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
fix tests
This commit is contained in:
parent
e5ac872b72
commit
fadcba1401
2 changed files with 16 additions and 3 deletions
|
@ -46,7 +46,10 @@ class WcGatewayTest extends TestCase
|
|||
->with($orderId)
|
||||
->andReturn($wcOrder);
|
||||
|
||||
global $woocommerce;
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$result = $testee->process_payment($orderId);
|
||||
unset($woocommerce);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals('success', $result['result']);
|
||||
$this->assertEquals($result['redirect'], $wcOrder);
|
||||
|
@ -72,7 +75,10 @@ class WcGatewayTest extends TestCase
|
|||
->with($orderId)
|
||||
->andReturn(false);
|
||||
|
||||
global $woocommerce;
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$this->assertNull($testee->process_payment($orderId));
|
||||
unset($woocommerce);
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,7 +112,10 @@ class WcGatewayTest extends TestCase
|
|||
expect('wc_add_notice')
|
||||
->with($lastError);
|
||||
|
||||
global $woocommerce;
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$result = $testee->process_payment($orderId);
|
||||
unset($woocommerce);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use Inpsyde\PayPalCommerce\ApiClient\Repository\CartRepository;
|
|||
use Inpsyde\PayPalCommerce\Session\SessionHandler;
|
||||
use Inpsyde\PayPalCommerce\TestCase;
|
||||
use Inpsyde\PayPalCommerce\WcGateway\Gateway\WcGateway;
|
||||
use Inpsyde\Woocommerce\Logging\WoocommerceLoggingModule;
|
||||
use Mockery;
|
||||
|
||||
class OrderProcessorTest extends TestCase
|
||||
|
@ -75,7 +76,8 @@ class OrderProcessorTest extends TestCase
|
|||
$cart = Mockery::mock(\WC_Cart::class);
|
||||
$cart
|
||||
->expects('empty_cart');
|
||||
$woocommerce = (object) ['cart' => $cart];
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$woocommerce->cart = $cart;
|
||||
|
||||
$wcOrder
|
||||
->expects('update_meta_data')
|
||||
|
@ -158,7 +160,8 @@ class OrderProcessorTest extends TestCase
|
|||
$cart = Mockery::mock(\WC_Cart::class);
|
||||
$cart
|
||||
->expects('empty_cart');
|
||||
$woocommerce = (object) ['cart' => $cart];
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$woocommerce->cart = $cart;
|
||||
|
||||
$wcOrder
|
||||
->expects('update_meta_data')
|
||||
|
@ -218,7 +221,8 @@ class OrderProcessorTest extends TestCase
|
|||
);
|
||||
|
||||
$cart = Mockery::mock(\WC_Cart::class);
|
||||
$woocommerce = (object) ['cart' => $cart];
|
||||
$woocommerce = Mockery::mock(\WooCommerce::class);
|
||||
$woocommerce->cart = $cart;
|
||||
|
||||
$wcOrder
|
||||
->expects('update_meta_data')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue