mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Fix tests
This commit is contained in:
parent
46ea7621d3
commit
c9595e29bd
3 changed files with 11 additions and 3 deletions
|
@ -258,7 +258,7 @@ class PurchaseUnitFactoryTest extends TestCase
|
|||
{
|
||||
$wcCustomer = Mockery::mock(\WC_Customer::class);
|
||||
expect('WC')
|
||||
->andReturn((object) ['customer' => $wcCustomer]);
|
||||
->andReturn((object) ['customer' => $wcCustomer, 'session' => null]);
|
||||
|
||||
$wcCart = Mockery::mock(\WC_Cart::class);
|
||||
$amount = Mockery::mock(Amount::class);
|
||||
|
@ -322,7 +322,7 @@ class PurchaseUnitFactoryTest extends TestCase
|
|||
public function testWcCartShippingGetsDroppendWhenNoCustomer()
|
||||
{
|
||||
expect('WC')
|
||||
->andReturn((object) ['customer' => null]);
|
||||
->andReturn((object) ['customer' => null, 'session' => null]);
|
||||
|
||||
$wcCart = Mockery::mock(\WC_Cart::class);
|
||||
$amount = Mockery::mock(Amount::class);
|
||||
|
@ -360,7 +360,7 @@ class PurchaseUnitFactoryTest extends TestCase
|
|||
public function testWcCartShippingGetsDroppendWhenNoCountryCode()
|
||||
{
|
||||
expect('WC')
|
||||
->andReturn((object) ['customer' => Mockery::mock(\WC_Customer::class)]);
|
||||
->andReturn((object) ['customer' => Mockery::mock(\WC_Customer::class), 'session' => null]);
|
||||
|
||||
$wcCart = Mockery::mock(\WC_Cart::class);
|
||||
$amount = Mockery::mock(Amount::class);
|
||||
|
|
|
@ -169,6 +169,7 @@ class CreateOrderEndpointTest extends TestCase
|
|||
false,
|
||||
['checkout'],
|
||||
false,
|
||||
['paypal'],
|
||||
new NullLogger()
|
||||
);
|
||||
return array($payer_factory, $testee);
|
||||
|
|
|
@ -5,6 +5,8 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Gateway;
|
|||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
|
@ -75,6 +77,11 @@ class WcGatewayTest extends TestCase
|
|||
->andReturnUsing(function () {
|
||||
return $this->fundingSource;
|
||||
});
|
||||
$order = Mockery::mock(Order::class);
|
||||
$order->shouldReceive('status')->andReturn(new OrderStatus(OrderStatus::APPROVED));
|
||||
$this->sessionHandler
|
||||
->shouldReceive('order')
|
||||
->andReturn($order);
|
||||
|
||||
$this->settings->shouldReceive('has')->andReturnFalse();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue