fix tests

This commit is contained in:
David Remer 2020-09-14 07:51:45 +03:00
parent 6db0a457bf
commit 7445c91ed7
37 changed files with 199 additions and 190 deletions

View file

@ -34,7 +34,7 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Inpsyde\\PayPalCommerce\\": "tests/PHPUnit/" "WooCommerce\\PayPalCommerce\\": "tests/PHPUnit/"
} }
}, },
"minimum-stability": "dev", "minimum-stability": "dev",

View file

@ -62,7 +62,7 @@ class Amount {
* *
* @return AmountBreakdown|null * @return AmountBreakdown|null
*/ */
public function breakdown(): AmountBreakdown { public function breakdown() {
return $this->breakdown; return $this->breakdown;
} }

View file

@ -1,12 +1,11 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Authentication; namespace WooCommerce\PayPalCommerce\ApiClient\Authentication;
use Brain\Monkey\Expectation\Exception\ExpectationArgsRequired; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Inpsyde\PayPalCommerce\ApiClient\TestCase;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Mockery; use Mockery;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;
@ -18,7 +17,7 @@ class PayPalBearerTest extends TestCase
{ {
expect('wp_json_encode')->andReturnUsing('json_encode'); expect('wp_json_encode')->andReturnUsing('json_encode');
$json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}'; $json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}';
$cache = Mockery::mock(CacheInterface::class); $cache = Mockery::mock(Cache::class);
$cache $cache
->expects('get') ->expects('get')
->andReturn('{"access_token":"abc","expires_in":100, "created":100}'); ->andReturn('{"access_token":"abc","expires_in":100, "created":100}');
@ -67,7 +66,7 @@ class PayPalBearerTest extends TestCase
{ {
expect('wp_json_encode')->andReturnUsing('json_encode'); expect('wp_json_encode')->andReturnUsing('json_encode');
$json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}'; $json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}';
$cache = Mockery::mock(CacheInterface::class); $cache = Mockery::mock(Cache::class);
$cache $cache
->expects('get') ->expects('get')
->andReturn(''); ->andReturn('');
@ -115,7 +114,7 @@ class PayPalBearerTest extends TestCase
public function testCachedTokenIsStillValid() public function testCachedTokenIsStillValid()
{ {
$json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}'; $json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}';
$cache = Mockery::mock(CacheInterface::class); $cache = Mockery::mock(Cache::class);
$cache $cache
->expects('get') ->expects('get')
->andReturn($json); ->andReturn($json);
@ -135,7 +134,7 @@ class PayPalBearerTest extends TestCase
public function testExceptionThrownOnError() public function testExceptionThrownOnError()
{ {
$json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}'; $json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}';
$cache = Mockery::mock(CacheInterface::class); $cache = Mockery::mock(Cache::class);
$cache $cache
->expects('get') ->expects('get')
->andReturn(''); ->andReturn('');
@ -178,7 +177,7 @@ class PayPalBearerTest extends TestCase
public function testExceptionThrownBecauseOfHttpStatusCode() public function testExceptionThrownBecauseOfHttpStatusCode()
{ {
$json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}'; $json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}';
$cache = Mockery::mock(CacheInterface::class); $cache = Mockery::mock(Cache::class);
$cache $cache
->expects('get') ->expects('get')
->andReturn(''); ->andReturn('');

View file

@ -1,26 +1,24 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Endpoint; namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
use Hamcrest\Matchers; use Hamcrest\Matchers;
use Inpsyde\PayPalCommerce\ApiClient\Authentication\Bearer; use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
use Inpsyde\PayPalCommerce\ApiClient\Entity\ApplicationContext; use WooCommerce\PayPalCommerce\ApiClient\Entity\ApplicationContext;
use Inpsyde\PayPalCommerce\ApiClient\Entity\ErrorResponseCollection; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
use Inpsyde\PayPalCommerce\ApiClient\Entity\OrderStatus; use WooCommerce\PayPalCommerce\ApiClient\Entity\PatchCollection;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PatchCollection; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payer;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payer; use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit; use WooCommerce\PayPalCommerce\ApiClient\Entity\Token;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Token; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Factory\OrderFactory;
use Inpsyde\PayPalCommerce\ApiClient\Factory\ErrorResponseCollectionFactory; use WooCommerce\PayPalCommerce\ApiClient\Factory\PatchCollectionFactory;
use Inpsyde\PayPalCommerce\ApiClient\Factory\OrderFactory; use WooCommerce\PayPalCommerce\ApiClient\Helper\ErrorResponse;
use Inpsyde\PayPalCommerce\ApiClient\Factory\PatchCollectionFactory; use WooCommerce\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository;
use Inpsyde\PayPalCommerce\ApiClient\Helper\ErrorResponse; use WooCommerce\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
use Inpsyde\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Inpsyde\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
use Inpsyde\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;

View file

@ -1,15 +1,15 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Endpoint; namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
use Inpsyde\PayPalCommerce\ApiClient\Entity\ApplicationContext; use WooCommerce\PayPalCommerce\ApiClient\Entity\ApplicationContext;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use Inpsyde\PayPalCommerce\ApiClient\Entity\OrderStatus; use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payer; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payer;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PaymentSource; use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentSource;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit; use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class OrderTest extends TestCase class OrderTest extends TestCase

View file

@ -2,16 +2,16 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Endpoint; namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
use Inpsyde\PayPalCommerce\ApiClient\Authentication\Bearer; use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Authorization; use WooCommerce\PayPalCommerce\ApiClient\Entity\Authorization;
use Inpsyde\PayPalCommerce\ApiClient\Entity\ErrorResponseCollection; use WooCommerce\PayPalCommerce\ApiClient\Entity\ErrorResponseCollection;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Token; use WooCommerce\PayPalCommerce\ApiClient\Entity\Token;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\Factory\AuthorizationFactory; use WooCommerce\PayPalCommerce\ApiClient\Factory\AuthorizationFactory;
use Inpsyde\PayPalCommerce\ApiClient\Factory\ErrorResponseCollectionFactory; use WooCommerce\PayPalCommerce\ApiClient\Factory\ErrorResponseCollectionFactory;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
class AddressTest extends TestCase class AddressTest extends TestCase
{ {

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class AmountBreakdownTest extends TestCase class AmountBreakdownTest extends TestCase

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class AmountTest extends TestCase class AmountTest extends TestCase

View file

@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
class AuthorizationStatusTest extends TestCase class AuthorizationStatusTest extends TestCase
{ {

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
class AuthorizationTest extends TestCase class AuthorizationTest extends TestCase
{ {

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class ItemTest extends TestCase class ItemTest extends TestCase

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
class MoneyTest extends TestCase class MoneyTest extends TestCase
{ {

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class PayerTest extends TestCase class PayerTest extends TestCase

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
class PaymentsTest extends TestCase class PaymentsTest extends TestCase
{ {

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class PurchaseUnitTest extends TestCase class PurchaseUnitTest extends TestCase

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Entity; namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;
class TokenTest extends TestCase class TokenTest extends TestCase

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class AddressFactoryTest extends TestCase class AddressFactoryTest extends TestCase

View file

@ -1,13 +1,13 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Amount; use WooCommerce\PayPalCommerce\ApiClient\Entity\Amount;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Item; use WooCommerce\PayPalCommerce\ApiClient\Entity\Item;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Money; use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;

View file

@ -2,12 +2,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Authorization; use WooCommerce\PayPalCommerce\ApiClient\Entity\Authorization;
use Inpsyde\PayPalCommerce\ApiClient\Entity\AuthorizationStatus; use WooCommerce\PayPalCommerce\ApiClient\Entity\AuthorizationStatus;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
class AuthorizationFactoryTest extends TestCase class AuthorizationFactoryTest extends TestCase
{ {

View file

@ -1,11 +1,11 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Item; use WooCommerce\PayPalCommerce\ApiClient\Entity\Item;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;
use Mockery; use Mockery;

View file

@ -1,16 +1,16 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use Inpsyde\PayPalCommerce\ApiClient\Entity\OrderStatus; use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payer; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payer;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PaymentSource; use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentSource;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit; use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository; use WooCommerce\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class OrderFactoryTest extends TestCase class OrderFactoryTest extends TestCase

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Address; use WooCommerce\PayPalCommerce\ApiClient\Entity\Address;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class PayerFactoryTest extends TestCase class PayerFactoryTest extends TestCase

View file

@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Authorization; use WooCommerce\PayPalCommerce\ApiClient\Entity\Authorization;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payments; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payments;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class PaymentsFactoryTest extends TestCase class PaymentsFactoryTest extends TestCase

View file

@ -1,17 +1,17 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Factory; namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Address; use WooCommerce\PayPalCommerce\ApiClient\Entity\Address;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Amount; use WooCommerce\PayPalCommerce\ApiClient\Entity\Amount;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Item; use WooCommerce\PayPalCommerce\ApiClient\Entity\Item;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payee; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payee;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payments; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payments;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit; use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Shipping; use WooCommerce\PayPalCommerce\ApiClient\Entity\Shipping;
use Inpsyde\PayPalCommerce\ApiClient\Repository\PayeeRepository; use WooCommerce\PayPalCommerce\ApiClient\Repository\PayeeRepository;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;
@ -36,11 +36,13 @@ class PurchaseUnitFactoryTest extends TestCase
$payee = Mockery::mock(Payee::class); $payee = Mockery::mock(Payee::class);
$payeeRepository $payeeRepository
->shouldReceive('payee')->andReturn($payee); ->shouldReceive('payee')->andReturn($payee);
$item = Mockery::mock(Item::class);
$item->shouldReceive('category')->andReturn(Item::PHYSICAL_GOODS);
$itemFactory = Mockery::mock(ItemFactory::class); $itemFactory = Mockery::mock(ItemFactory::class);
$itemFactory $itemFactory
->shouldReceive('from_wc_order') ->shouldReceive('from_wc_order')
->with($wcOrder) ->with($wcOrder)
->andReturn([]); ->andReturn([$item]);
$address = Mockery::mock(Address::class); $address = Mockery::mock(Address::class);
$address $address
@ -77,7 +79,7 @@ class PurchaseUnitFactoryTest extends TestCase
$this->assertEquals('WC-' . $wcOrderId, $unit->custom_id()); $this->assertEquals('WC-' . $wcOrderId, $unit->custom_id());
$this->assertEquals('', $unit->soft_descriptor()); $this->assertEquals('', $unit->soft_descriptor());
$this->assertEquals('WC-' . $wcOrderId, $unit->invoice_id()); $this->assertEquals('WC-' . $wcOrderId, $unit->invoice_id());
$this->assertEquals([], $unit->items()); $this->assertEquals([$item], $unit->items());
$this->assertEquals($amount, $unit->amount()); $this->assertEquals($amount, $unit->amount());
$this->assertEquals($shipping, $unit->shipping()); $this->assertEquals($shipping, $unit->shipping());
} }
@ -98,11 +100,12 @@ class PurchaseUnitFactoryTest extends TestCase
$payee = Mockery::mock(Payee::class); $payee = Mockery::mock(Payee::class);
$payeeRepository $payeeRepository
->expects('payee')->andReturn($payee); ->expects('payee')->andReturn($payee);
$item = Mockery::mock(Item::class, ['category' => Item::PHYSICAL_GOODS]);
$itemFactory = Mockery::mock(ItemFactory::class); $itemFactory = Mockery::mock(ItemFactory::class);
$itemFactory $itemFactory
->expects('from_wc_order') ->expects('from_wc_order')
->with($wcOrder) ->with($wcOrder)
->andReturn([]); ->andReturn([$item]);
$address = Mockery::mock(Address::class); $address = Mockery::mock(Address::class);
$address $address
@ -152,11 +155,12 @@ class PurchaseUnitFactoryTest extends TestCase
$payee = Mockery::mock(Payee::class); $payee = Mockery::mock(Payee::class);
$payeeRepository $payeeRepository
->expects('payee')->andReturn($payee); ->expects('payee')->andReturn($payee);
$item = Mockery::mock(Item::class, ['category' => Item::PHYSICAL_GOODS]);
$itemFactory = Mockery::mock(ItemFactory::class); $itemFactory = Mockery::mock(ItemFactory::class);
$itemFactory $itemFactory
->expects('from_wc_order') ->expects('from_wc_order')
->with($wcOrder) ->with($wcOrder)
->andReturn([]); ->andReturn([$item]);
$address = Mockery::mock(Address::class); $address = Mockery::mock(Address::class);
$address $address
@ -203,11 +207,14 @@ class PurchaseUnitFactoryTest extends TestCase
$payee = Mockery::mock(Payee::class); $payee = Mockery::mock(Payee::class);
$payeeRepository $payeeRepository
->expects('payee')->andReturn($payee); ->expects('payee')->andReturn($payee);
$item = Mockery::mock(Item::class);
$item->shouldReceive('category')->andReturn(Item::PHYSICAL_GOODS);
$itemFactory = Mockery::mock(ItemFactory::class); $itemFactory = Mockery::mock(ItemFactory::class);
$itemFactory $itemFactory
->expects('from_wc_cart') ->expects('from_wc_cart')
->with($wcCart) ->with($wcCart)
->andReturn([]); ->andReturn([$item]);
$address = Mockery::mock(Address::class); $address = Mockery::mock(Address::class);
$address $address
@ -244,7 +251,7 @@ class PurchaseUnitFactoryTest extends TestCase
$this->assertEquals('', $unit->custom_id()); $this->assertEquals('', $unit->custom_id());
$this->assertEquals('', $unit->soft_descriptor()); $this->assertEquals('', $unit->soft_descriptor());
$this->assertEquals('', $unit->invoice_id()); $this->assertEquals('', $unit->invoice_id());
$this->assertEquals([], $unit->items()); $this->assertEquals([$item], $unit->items());
$this->assertEquals($amount, $unit->amount()); $this->assertEquals($amount, $unit->amount());
$this->assertEquals($shipping, $unit->shipping()); $this->assertEquals($shipping, $unit->shipping());
} }
@ -266,11 +273,13 @@ class PurchaseUnitFactoryTest extends TestCase
$payee = Mockery::mock(Payee::class); $payee = Mockery::mock(Payee::class);
$payeeRepository $payeeRepository
->expects('payee')->andReturn($payee); ->expects('payee')->andReturn($payee);
$item = Mockery::mock(Item::class);
$item->shouldReceive('category')->andReturn(Item::PHYSICAL_GOODS);
$itemFactory = Mockery::mock(ItemFactory::class); $itemFactory = Mockery::mock(ItemFactory::class);
$itemFactory $itemFactory
->expects('from_wc_cart') ->expects('from_wc_cart')
->with($wcCart) ->with($wcCart)
->andReturn([]); ->andReturn([$item]);
$shippingFactory = Mockery::mock(ShippingFactory::class); $shippingFactory = Mockery::mock(ShippingFactory::class);
$paymentsFacory = Mockery::mock(PaymentsFactory::class); $paymentsFacory = Mockery::mock(PaymentsFactory::class);
$testee = new PurchaseUnitFactory( $testee = new PurchaseUnitFactory(
@ -303,11 +312,13 @@ class PurchaseUnitFactoryTest extends TestCase
$payee = Mockery::mock(Payee::class); $payee = Mockery::mock(Payee::class);
$payeeRepository $payeeRepository
->expects('payee')->andReturn($payee); ->expects('payee')->andReturn($payee);
$item = Mockery::mock(Item::class);
$item->shouldReceive('category')->andReturn(Item::PHYSICAL_GOODS);
$itemFactory = Mockery::mock(ItemFactory::class); $itemFactory = Mockery::mock(ItemFactory::class);
$itemFactory $itemFactory
->expects('from_wc_cart') ->expects('from_wc_cart')
->with($wcCart) ->with($wcCart)
->andReturn([]); ->andReturn([$item]);
$address = Mockery::mock(Address::class); $address = Mockery::mock(Address::class);
$address $address
@ -355,11 +366,12 @@ class PurchaseUnitFactoryTest extends TestCase
$payee = Mockery::mock(Payee::class); $payee = Mockery::mock(Payee::class);
$payeeRepository $payeeRepository
->expects('payee')->andReturn($payee); ->expects('payee')->andReturn($payee);
$item = Mockery::mock(Item::class, ['category' => Item::PHYSICAL_GOODS]);
$itemFactory = Mockery::mock(ItemFactory::class); $itemFactory = Mockery::mock(ItemFactory::class);
$itemFactory $itemFactory
->expects('from_wc_cart') ->expects('from_wc_cart')
->with($wcCart) ->with($wcCart)
->andReturn([]); ->andReturn([$item]);
$address = Mockery::mock(Address::class); $address = Mockery::mock(Address::class);
$address $address
@ -552,7 +564,7 @@ class PurchaseUnitFactoryTest extends TestCase
'shipping' => '', 'shipping' => '',
]; ];
$this->expectException(\Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException::class); $this->expectException(\WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException::class);
$testee->from_paypal_response($response); $testee->from_paypal_response($response);
} }

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Repository; namespace WooCommerce\PayPalCommerce\ApiClient\Repository;
use Inpsyde\PayPalCommerce\ApiClient\Config\Config; use WooCommerce\PayPalCommerce\ApiClient\Config\Config;
use Inpsyde\PayPalCommerce\ApiClient\TestCase; use WooCommerce\PayPalCommerce\ApiClient\TestCase;
use Mockery; use Mockery;
class PayeeRepositoryTest extends TestCase class PayeeRepositoryTest extends TestCase

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient; namespace WooCommerce\PayPalCommerce\ApiClient;
use function Brain\Monkey\setUp; use function Brain\Monkey\setUp;
use function Brain\Monkey\tearDown; use function Brain\Monkey\tearDown;

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\Button\Endpoint; namespace WooCommerce\PayPalCommerce\Button\Endpoint;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit; use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use Inpsyde\PayPalCommerce\ApiClient\Repository\CartRepository; use WooCommerce\PayPalCommerce\ApiClient\Repository\CartRepository;
use Inpsyde\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use Mockery; use Mockery;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;

View file

@ -1,14 +1,14 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\Button\Helper; namespace WooCommerce\PayPalCommerce\Button\Helper;
use Inpsyde\PayPalCommerce\ApiClient\Entity\CardAuthenticationResult; use WooCommerce\PayPalCommerce\ApiClient\Entity\CardAuthenticationResult;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PaymentSource; use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentSource;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PaymentSourceCard; use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentSourceCard;
use Inpsyde\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use Mockery\Mock; use Mockery\Mock;
class ThreeDSecureTest extends TestCase class ThreeDSecureTest extends TestCase

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce; namespace WooCommerce\PayPalCommerce;
use function Brain\Monkey\setUp; use function Brain\Monkey\setUp;
use function Brain\Monkey\tearDown; use function Brain\Monkey\tearDown;

View file

@ -2,18 +2,18 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\WcGateway\Checkout; namespace WooCommerce\PayPalCommerce\WcGateway\Checkout;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Address; use WooCommerce\PayPalCommerce\ApiClient\Entity\Address;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payer; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payer;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PayerName; use WooCommerce\PayPalCommerce\ApiClient\Entity\PayerName;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Phone; use WooCommerce\PayPalCommerce\ApiClient\Entity\Phone;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PhoneWithType; use WooCommerce\PayPalCommerce\ApiClient\Entity\PhoneWithType;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit; use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Shipping; use WooCommerce\PayPalCommerce\ApiClient\Entity\Shipping;
use Inpsyde\PayPalCommerce\Session\SessionHandler; use WooCommerce\PayPalCommerce\Session\SessionHandler;
use Inpsyde\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use Mockery\MockInterface; use Mockery\MockInterface;
class CheckoutPayPalAddressPresetTest extends TestCase class CheckoutPayPalAddressPresetTest extends TestCase

View file

@ -1,18 +1,18 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\WcGateway\Gateway; namespace WooCommerce\PayPalCommerce\WcGateway\Gateway;
use Inpsyde\PayPalCommerce\Onboarding\Render\OnboardingRenderer; use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer;
use Inpsyde\PayPalCommerce\Session\SessionHandler; use WooCommerce\PayPalCommerce\Session\SessionHandler;
use Inpsyde\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use Inpsyde\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice; use WooCommerce\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice;
use Inpsyde\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor; use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
use Inpsyde\PayPalCommerce\WcGateway\Processor\OrderProcessor; use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderProcessor;
use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsFields; use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsFields;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsRenderer; use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
use Mockery; use Mockery;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;

View file

@ -1,19 +1,19 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\WcGateway\Processor; namespace WooCommerce\PayPalCommerce\WcGateway\Processor;
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\PaymentsEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentsEndpoint;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Authorization; use WooCommerce\PayPalCommerce\ApiClient\Entity\Authorization;
use Inpsyde\PayPalCommerce\ApiClient\Entity\AuthorizationStatus; use WooCommerce\PayPalCommerce\ApiClient\Entity\AuthorizationStatus;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Payments; use WooCommerce\PayPalCommerce\ApiClient\Entity\Payments;
use Inpsyde\PayPalCommerce\ApiClient\Entity\PurchaseUnit; use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use Inpsyde\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use Mockery; use Mockery;
class AuthorizedPaymentsProcessorTest extends TestCase class AuthorizedPaymentsProcessorTest extends TestCase
{ {

View file

@ -1,21 +1,21 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\WcGateway\Processor; namespace WooCommerce\PayPalCommerce\WcGateway\Processor;
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\PaymentsEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentsEndpoint;
use Inpsyde\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use Inpsyde\PayPalCommerce\ApiClient\Entity\OrderStatus; use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
use Inpsyde\PayPalCommerce\ApiClient\Factory\OrderFactory; use WooCommerce\PayPalCommerce\ApiClient\Factory\OrderFactory;
use Inpsyde\PayPalCommerce\ApiClient\Repository\CartRepository; use WooCommerce\PayPalCommerce\ApiClient\Repository\CartRepository;
use Inpsyde\PayPalCommerce\Button\Helper\ThreeDSecure; use WooCommerce\PayPalCommerce\Button\Helper\ThreeDSecure;
use Inpsyde\PayPalCommerce\Session\SessionHandler; use WooCommerce\PayPalCommerce\Session\SessionHandler;
use Inpsyde\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
use Inpsyde\WooCommerce\Logging\WooCommerceLoggingModule; use WooCommerce\WooCommerce\Logging\WooCommerceLoggingModule;
use Mockery; use Mockery;
class OrderProcessorTest extends TestCase class OrderProcessorTest extends TestCase

View file

@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Repository; namespace WooCommerce\PayPalCommerce\ApiClient\Repository;
use Hamcrest\Matchers; use Hamcrest\Matchers;
use Inpsyde\PayPalCommerce\ApiClient\Entity\ApplicationContext; use WooCommerce\PayPalCommerce\ApiClient\Entity\ApplicationContext;
use Inpsyde\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\TestCase;
use Mockery\MockInterface; use Mockery\MockInterface;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use function Brain\Monkey\Functions\expect; use function Brain\Monkey\Functions\expect;

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\ApiClient\Repository; namespace WooCommerce\PayPalCommerce\ApiClient\Repository;
use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\Adapter\Phpunit\MockeryTestCase;

View file

@ -1,5 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../stubs/WC_Payment_Gateway.php'; require_once __DIR__ . '/../stubs/WC_Payment_Gateway.php';
require_once __DIR__ . '/../stubs/WC_Ajax.php'; require_once __DIR__ . '/../stubs/WC_Ajax.php';