mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add test for AuthorizationStatus
This commit is contained in:
parent
48970fa4b7
commit
ed8ec50601
2 changed files with 53 additions and 0 deletions
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Inpsyde\PayPalCommerce\ApiClient\Entity;
|
||||
|
||||
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
|
||||
class AuthorizationStatus
|
||||
{
|
||||
const INTERNAL = 'INTERNAL';
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<?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'],
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue