mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge trunk
This commit is contained in:
commit
e153e2be35
18 changed files with 208 additions and 35 deletions
|
@ -16,6 +16,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Payments;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\OrderFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\OrderHelper;
|
||||
use WooCommerce\PayPalCommerce\Button\Helper\ThreeDSecure;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
|
@ -129,6 +130,8 @@ class OrderProcessorTest extends TestCase
|
|||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
$subscription_helper->shouldReceive('has_subscription');
|
||||
|
||||
$order_helper = Mockery::mock(OrderHelper::class);
|
||||
|
||||
$testee = new OrderProcessor(
|
||||
$sessionHandler,
|
||||
$orderEndpoint,
|
||||
|
@ -138,7 +141,8 @@ class OrderProcessorTest extends TestCase
|
|||
$settings,
|
||||
$logger,
|
||||
$this->environment,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
$order_helper
|
||||
);
|
||||
|
||||
$wcOrder
|
||||
|
@ -166,6 +170,8 @@ class OrderProcessorTest extends TestCase
|
|||
->with($transactionId);
|
||||
$wcOrder->shouldReceive('save');
|
||||
|
||||
$order_helper->shouldReceive('contains_physical_goods')->andReturn(true);
|
||||
|
||||
$this->assertTrue($testee->process($wcOrder));
|
||||
}
|
||||
|
||||
|
@ -248,6 +254,8 @@ class OrderProcessorTest extends TestCase
|
|||
$logger = Mockery::mock(LoggerInterface::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$order_helper = Mockery::mock(OrderHelper::class);
|
||||
|
||||
$testee = new OrderProcessor(
|
||||
$sessionHandler,
|
||||
$orderEndpoint,
|
||||
|
@ -257,7 +265,8 @@ class OrderProcessorTest extends TestCase
|
|||
$settings,
|
||||
$logger,
|
||||
$this->environment,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
$order_helper
|
||||
);
|
||||
|
||||
$wcOrder
|
||||
|
@ -280,6 +289,8 @@ class OrderProcessorTest extends TestCase
|
|||
->expects('payment_complete');
|
||||
$wcOrder->shouldReceive('save');
|
||||
|
||||
$order_helper->shouldReceive('contains_physical_goods')->andReturn(true);
|
||||
|
||||
$this->assertTrue($testee->process($wcOrder));
|
||||
}
|
||||
|
||||
|
@ -309,6 +320,10 @@ class OrderProcessorTest extends TestCase
|
|||
->expects('is')
|
||||
->with(OrderStatus::APPROVED)
|
||||
->andReturn(false);
|
||||
$orderStatus
|
||||
->expects('is')
|
||||
->with(OrderStatus::CREATED)
|
||||
->andReturn(false);
|
||||
$orderId = 'abc';
|
||||
$orderIntent = 'CAPTURE';
|
||||
$currentOrder = Mockery::mock(Order::class);
|
||||
|
@ -346,6 +361,8 @@ class OrderProcessorTest extends TestCase
|
|||
$logger = Mockery::mock(LoggerInterface::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$order_helper = Mockery::mock(OrderHelper::class);
|
||||
|
||||
$testee = new OrderProcessor(
|
||||
$sessionHandler,
|
||||
$orderEndpoint,
|
||||
|
@ -355,7 +372,8 @@ class OrderProcessorTest extends TestCase
|
|||
$settings,
|
||||
$logger,
|
||||
$this->environment,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
$order_helper
|
||||
);
|
||||
|
||||
$wcOrder
|
||||
|
@ -372,6 +390,8 @@ class OrderProcessorTest extends TestCase
|
|||
);
|
||||
$wcOrder->shouldReceive('save');
|
||||
|
||||
$order_helper->shouldReceive('contains_physical_goods')->andReturn(true);
|
||||
|
||||
$this->assertFalse($testee->process($wcOrder));
|
||||
$this->assertNotEmpty($testee->last_error());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue