2020-08-31 13:38:54 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-09-14 07:51:45 +03:00
|
|
|
namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2020-09-14 07:51:45 +03:00
|
|
|
use WooCommerce\PayPalCommerce\ApiClient\TestCase;
|
2020-08-31 13:38:54 +03:00
|
|
|
|
|
|
|
class PaymentsTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testAuthorizations()
|
|
|
|
{
|
|
|
|
$authorization = \Mockery::mock(Authorization::class);
|
|
|
|
$authorizations = [$authorization];
|
|
|
|
|
|
|
|
$testee = new Payments(...$authorizations);
|
|
|
|
|
|
|
|
$this->assertEquals($authorizations, $testee->authorizations());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testToArray()
|
|
|
|
{
|
|
|
|
$authorization = \Mockery::mock(Authorization::class);
|
2020-09-01 09:47:36 +03:00
|
|
|
$authorization->shouldReceive('to_array')->andReturn(
|
2020-08-31 13:38:54 +03:00
|
|
|
[
|
|
|
|
'id' => 'foo',
|
|
|
|
'status' => 'CREATED',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
$authorizations = [$authorization];
|
|
|
|
|
|
|
|
$testee = new Payments(...$authorizations);
|
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
[
|
|
|
|
'authorizations' => [
|
|
|
|
[
|
|
|
|
'id' => 'foo',
|
|
|
|
'status' => 'CREATED',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
2020-09-01 09:47:36 +03:00
|
|
|
$testee->to_array()
|
2020-08-31 13:38:54 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|