mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Inpsyde\PayPalCommerce\ApiClient\Entity;
|
|
|
|
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
|
use Inpsyde\PayPalCommerce\ApiClient\TestCase;
|
|
|
|
class AuthorizationStatusTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider statusDataProvider
|
|
* @param $status
|
|
*/
|
|
public function testValidStatusProvided($status)
|
|
{
|
|
$authorizationStatus = new AuthorizationStatus($status);
|
|
|
|
$this->assertEquals($authorizationStatus->name(), $status);
|
|
}
|
|
|
|
public function testInvalidStatusProvided()
|
|
{
|
|
$this->expectException(RuntimeException::class);
|
|
|
|
new AuthorizationStatus('invalid');
|
|
}
|
|
|
|
public function testStatusComparision()
|
|
{
|
|
$authorizationStatus = new AuthorizationStatus('CREATED');
|
|
|
|
$this->assertTrue($authorizationStatus->is('CREATED'));
|
|
$this->assertFalse($authorizationStatus->is('NOT_CREATED'));
|
|
}
|
|
|
|
public function statusDataProvider(): array
|
|
{
|
|
return [
|
|
['INTERNAL'],
|
|
['CREATED'],
|
|
['CAPTURED'],
|
|
['DENIED'],
|
|
['EXPIRED'],
|
|
['PARTIALLY_CAPTURED'],
|
|
['VOIDED'],
|
|
['PENDING'],
|
|
];
|
|
}
|
|
}
|