forked from LiveCarta/PayPal-PHP-Server-SDK
repo initialized with test cases
This commit is contained in:
209
tests/UnitTests/OrdersControllerTest.php
Normal file
209
tests/UnitTests/OrdersControllerTest.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PayPalRESTAPIsLib
|
||||
*
|
||||
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
||||
*/
|
||||
|
||||
namespace PayPalRESTAPIsLib\Tests\UnitTests;
|
||||
|
||||
use PayPalRESTAPIsLib\Controllers\OrdersController;
|
||||
use PayPalRESTAPIsLib\Models\Builders\ConfirmOrderRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\OrderRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\OrderTrackerRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\PatchBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\PaymentSourceBuilder;
|
||||
use PayPalRESTAPIsLib\Models\CheckoutPaymentIntent;
|
||||
use PayPalRESTAPIsLib\Models\PatchOp;
|
||||
use PayPalRESTAPIsLib\Tests\Controllers\BaseTestController;
|
||||
|
||||
class OrdersControllerTest extends BaseTestController
|
||||
{
|
||||
/**
|
||||
* @var OrdersController OrdersController instance
|
||||
*/
|
||||
protected static $controller;
|
||||
private const NON_EXISTENT_ORDER_ID = 'id-4';
|
||||
private const NON_EXISTENT_TRACKER_ID = '5UA89551P20376023-443844607820';
|
||||
private const ALREADY_CAPTURED_ID = '123';
|
||||
|
||||
/**
|
||||
* Setup test class
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
self::$controller = parent::getClient()->getOrdersController();
|
||||
}
|
||||
|
||||
public function testOrdersCreateWithStatus400()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'body' => OrderRequestBuilder::init(
|
||||
CheckoutPaymentIntent::CAPTURE,
|
||||
[]
|
||||
)->build(),
|
||||
'payPalRequestId' => 'PayPal-Request-Id',
|
||||
'payPalPartnerAttributionId' => 'PayPal-Partner-Attribution-Id2',
|
||||
'payPalClientMetadataId' => 'PayPal-Client-Metadata-Id',
|
||||
'prefer' => 'return=minimal'
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->ordersCreate($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(400)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testOrdersPatchWithStatus400()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'body' => PatchBuilder::init(
|
||||
PatchOp::ADD
|
||||
)->build(),
|
||||
'id' => self::NON_EXISTENT_ORDER_ID,
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->ordersPatch($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(400)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testOrdersGetWithStatus204()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'id' => self::NON_EXISTENT_ORDER_ID
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->ordersPatch($request);
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isSuccess());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(204)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testOrdersConfirmWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'body' => ConfirmOrderRequestBuilder::init(
|
||||
PaymentSourceBuilder::init()->build()
|
||||
)->build(),
|
||||
'id' => self::NON_EXISTENT_ORDER_ID,
|
||||
'prefer' => 'return=minimal'
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->ordersConfirm($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testOrdersAuthorizeWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'id' => self::NON_EXISTENT_ORDER_ID,
|
||||
'prefer' => 'return=minimal'
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->ordersAuthorize($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testOrdersTrackCreateWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'id' => self::NON_EXISTENT_ORDER_ID,
|
||||
'body' => OrderTrackerRequestBuilder::init(
|
||||
self::ALREADY_CAPTURED_ID
|
||||
)->notifyPayer(false)->build(),
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->ordersTrackCreate($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(400)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testOrdersTrackersPatchWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'id' => self::NON_EXISTENT_ORDER_ID,
|
||||
'trackerId' => self::NON_EXISTENT_TRACKER_ID,
|
||||
'body' => [
|
||||
PatchBuilder::init(
|
||||
PatchOp::REPLACE
|
||||
)
|
||||
->path('/notify_payer')
|
||||
->value(true)
|
||||
->build()
|
||||
]
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->ordersTrackersPatch($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
}
|
||||
208
tests/UnitTests/PaymentsControllerTest.php
Normal file
208
tests/UnitTests/PaymentsControllerTest.php
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PayPalRESTAPIsLib
|
||||
*
|
||||
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
||||
*/
|
||||
|
||||
namespace PayPalRESTAPIsLib\Tests\UnitTests;
|
||||
|
||||
use PayPalRESTAPIsLib\Controllers\PaymentsController;
|
||||
use PayPalRESTAPIsLib\Models\Builders\CaptureRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\MoneyBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\RefundRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Tests\Controllers\BaseTestController;
|
||||
|
||||
class PaymentsControllerTest extends BaseTestController
|
||||
{
|
||||
/**
|
||||
* @var PaymentsController PaymentsController instance
|
||||
*/
|
||||
protected static $controller;
|
||||
private const NON_EXISTENT_AUTHORIZATION_ID = 'authorization_id8';
|
||||
private const NON_EXISTENT_CAPTURE_ID = 'capture_id';
|
||||
private const NON_EXISTENT_REFUND_ID = 'refund_id';
|
||||
private const ALREADY_AUTHORIZED_ID = '3BJ81821K7933911P';
|
||||
|
||||
/**
|
||||
* Setup test class
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
self::$controller = parent::getClient()->getPaymentsController();
|
||||
}
|
||||
|
||||
public function testAuthorizationsGetWithStatus404()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->authorizationsGet(self::NON_EXISTENT_AUTHORIZATION_ID);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json;charset=UTF-8', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testCapturesGetWithStatus404()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->capturesGet(self::NON_EXISTENT_CAPTURE_ID);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json;charset=UTF-8', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testRefundsGetWithStatus404()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->refundsGet(self::NON_EXISTENT_REFUND_ID);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testAuthorizationsCaptureWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'body' => CaptureRequestBuilder::init()->finalCapture(false)->build(),
|
||||
'authorizationId' => self::NON_EXISTENT_AUTHORIZATION_ID,
|
||||
'prefer' => 'return=minimal'
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->authorizationsCapture($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json;charset=UTF-8', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testAuthorizationsReauthorizeWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'authorizationId' => self::NON_EXISTENT_AUTHORIZATION_ID,
|
||||
'prefer' => 'return=minimal'
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->authorizationsReauthorize($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json;charset=UTF-8', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testAuthorizationsVoidWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'authorizationId' => self::NON_EXISTENT_AUTHORIZATION_ID,
|
||||
'prefer' => 'return=minimal'
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->authorizationsVoid($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testAuthorizationsVoidWithStatus422()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'authorizationId' => self::ALREADY_AUTHORIZED_ID,
|
||||
'prefer' => 'return=minimal'
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->authorizationsVoid($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(422)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testCapturesRefundWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'captureId' => self::NON_EXISTENT_CAPTURE_ID,
|
||||
'prefer' => 'return=minimal',
|
||||
'body' => RefundRequestBuilder::init()
|
||||
->amount(
|
||||
MoneyBuilder::init(
|
||||
'USD',
|
||||
'1.44'
|
||||
)->build()
|
||||
)
|
||||
->noteToPayer('Defective product')
|
||||
->build()
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->capturesRefund($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
}
|
||||
242
tests/UnitTests/VaultControllerTest.php
Normal file
242
tests/UnitTests/VaultControllerTest.php
Normal file
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PayPalRESTAPIsLib
|
||||
*
|
||||
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
||||
*/
|
||||
|
||||
namespace PayPalRESTAPIsLib\Tests\UnitTests;
|
||||
|
||||
use PayPalRESTAPIsLib\Controllers\VaultController;
|
||||
use PayPalRESTAPIsLib\Models\Builders\PaymentTokenRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\PaymentTokenRequestPaymentSourceBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\SetupTokenRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\SetupTokenRequestPaymentSourceBuilder;
|
||||
use PayPalRESTAPIsLib\Models\Builders\VaultTokenRequestBuilder;
|
||||
use PayPalRESTAPIsLib\Models\TokenType;
|
||||
use PayPalRESTAPIsLib\Tests\Controllers\BaseTestController;
|
||||
|
||||
class VaultControllerTest extends BaseTestController
|
||||
{
|
||||
/**
|
||||
* @var VaultController OrdersController instance
|
||||
*/
|
||||
protected static $controller;
|
||||
private const NON_EXISTENT_SETUP_TOKEN_ID = 'setup-1';
|
||||
private const NON_EXISTENT_PAYMENT_TOKEN_ID = 'payment-1';
|
||||
private const NON_EXISTENT_CUSTOMER_ID = 'customer-1';
|
||||
private const INVALID_ID = "'dw";
|
||||
|
||||
/**
|
||||
* Setup test class
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
self::$controller = parent::getClient()->getVaultController();
|
||||
}
|
||||
|
||||
public function testSetupTokensCreateWithStatus400()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'payPalRequestId' => '',
|
||||
'body' => SetupTokenRequestBuilder::init(
|
||||
SetupTokenRequestPaymentSourceBuilder::init()->build()
|
||||
)->build()
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->setupTokensCreate($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(400)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testPaymentTokensCreateWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'body' => PaymentTokenRequestBuilder::init(
|
||||
PaymentTokenRequestPaymentSourceBuilder::init()->build()
|
||||
)->build(),
|
||||
'payPalRequestId' => '',
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->paymentTokensCreate($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testPaymentTokensCreateWithStatus400()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'body' => PaymentTokenRequestBuilder::init(
|
||||
PaymentTokenRequestPaymentSourceBuilder::init()
|
||||
->token(VaultTokenRequestBuilder::init(self::INVALID_ID, TokenType::SETUP_TOKEN)->build())
|
||||
->build()
|
||||
)->build(),
|
||||
'payPalRequestId' => '',
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->paymentTokensCreate($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(400)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testSetupTokensGetWithStatus404()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->setupTokensGet(self::NON_EXISTENT_SETUP_TOKEN_ID);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testSetupTokensGetWithStatus400()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->setupTokensGet(self::INVALID_ID);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(400)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testPaymentTokensGetWithStatus404()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->paymentTokensGet(self::NON_EXISTENT_PAYMENT_TOKEN_ID);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testPaymentTokensGetWithStatus400()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->paymentTokensGet(self::NON_EXISTENT_PAYMENT_TOKEN_ID);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testCustomerPaymentTokensGetWithStatus404()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'customerId' => self::NON_EXISTENT_CUSTOMER_ID,
|
||||
'pageSize' => 5,
|
||||
'page' => 1,
|
||||
'totalRequired' => false,
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->customerPaymentTokensGet($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(404)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testCustomerPaymentTokensGetWithStatus400()
|
||||
{
|
||||
// Parameters for the API call
|
||||
$request = [
|
||||
'customerId' => self::INVALID_ID,
|
||||
'pageSize' => 5,
|
||||
'page' => 1,
|
||||
'totalRequired' => false,
|
||||
];
|
||||
// Perform API call
|
||||
$result = self::$controller->customerPaymentTokensGet($request);
|
||||
|
||||
$headers = [];
|
||||
$headers['Content-Type'] = ['application/json', true];
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isError());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(400)
|
||||
->allowExtraHeaders()
|
||||
->expectHeaders($headers)
|
||||
->assert();
|
||||
}
|
||||
|
||||
public function testPaymentTokensDeleteWithStatus204()
|
||||
{
|
||||
// Perform API call
|
||||
$result = self::$controller->paymentTokensDelete(self::NON_EXISTENT_PAYMENT_TOKEN_ID);
|
||||
|
||||
// Assert result with expected response
|
||||
$this->assertTrue($result->isSuccess());
|
||||
$this->newTestCase($result->getResult())
|
||||
->expectStatus(204)
|
||||
->assert();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user