🔀 Merge branch 'PCP-4903’

This commit is contained in:
Philipp Stracker 2025-06-20 16:16:07 +02:00
commit c436c24242
No known key found for this signature in database
3 changed files with 9 additions and 6 deletions

View file

@ -24,8 +24,6 @@ use WooCommerce\PayPalCommerce\TestCase;
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
use WooCommerce\PayPalCommerce\Vaulting\VaultedCreditCardHandler;
use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
use function Brain\Monkey\Functions\expect;
use function Brain\Monkey\Functions\when;
class VaultedCreditCardHandlerTest extends TestCase
{
@ -123,6 +121,7 @@ class VaultedCreditCardHandlerTest extends TestCase
$capture->shouldReceive('status')->andReturn($captureStatus);
$payments->shouldReceive('captures')->andReturn([$capture]);
$purchaseUnit->shouldReceive('payments')->andReturn($payments);
$purchaseUnit->shouldReceive('shipping')->andReturn(null);
$this->orderEndpoint->shouldReceive('create')
->with([$purchaseUnit], 'some_preference', $payer, '', array(), $requestPaymentSource)

View file

@ -9,7 +9,6 @@ use WC_Order;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
use WooCommerce\PayPalCommerce\ApiClient\Entity\ExperienceContext;
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentSource;
use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\ApiClient\Factory\ExperienceContextBuilder;
@ -111,6 +110,7 @@ private $testee;
$order->shouldReceive('intent');
$order->shouldReceive('payment_source');
$order->shouldReceive('payer');
$order->shouldReceive('purchase_units')->andReturn([]);
$this->orderEndpoint
->shouldReceive('create')

View file

@ -23,13 +23,11 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\OrderHelper;
use WooCommerce\PayPalCommerce\Button\Helper\ThreeDSecure;
use WooCommerce\PayPalCommerce\WcGateway\Helper\Environment;
use WooCommerce\PayPalCommerce\Session\SessionHandler;
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer;
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
use WooCommerce\PayPalCommerce\TestCase;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
use Mockery;
use function Brain\Monkey\Functions\when;
class OrderProcessorTest extends TestCase
{
@ -59,6 +57,8 @@ class OrderProcessorTest extends TestCase
$purchaseUnit = Mockery::mock(PurchaseUnit::class);
$purchaseUnit->shouldReceive('payments')
->andReturn($payments);
$purchaseUnit->shouldReceive('shipping')
->andReturn(null);
$wcOrder = Mockery::mock(\WC_Order::class);
$wcOrder->expects('get_items')->andReturn([]);
@ -213,6 +213,8 @@ class OrderProcessorTest extends TestCase
$purchaseUnit = Mockery::mock(PurchaseUnit::class);
$purchaseUnit->shouldReceive('payments')
->andReturn($payments);
$purchaseUnit->shouldReceive('shipping')
->andReturn(null);
$wcOrder = Mockery::mock(\WC_Order::class);
$wcOrder->expects('get_items')->andReturn([]);
@ -348,7 +350,9 @@ class OrderProcessorTest extends TestCase
$purchaseUnit = Mockery::mock(PurchaseUnit::class);
$purchaseUnit->shouldReceive('payments')
->andReturn($payments);
->andReturn($payments);;
$purchaseUnit->shouldReceive('shipping')
->andReturn(null);
$wcOrder = Mockery::mock(\WC_Order::class);