enable refunds through gateway

This commit is contained in:
David Remer 2020-09-28 11:47:24 +03:00
parent a609b6f90b
commit d6abaafadb
14 changed files with 775 additions and 37 deletions

View file

@ -8,15 +8,24 @@ use WooCommerce\PayPalCommerce\ApiClient\TestCase;
class PaymentsTest extends TestCase
{
public function testAuthorizations()
{
$authorization = \Mockery::mock(Authorization::class);
$authorizations = [$authorization];
public function testAuthorizations()
{
$authorization = \Mockery::mock(Authorization::class);
$authorizations = [$authorization];
$testee = new Payments(...$authorizations);
$testee = new Payments($authorizations, []);
$this->assertEquals($authorizations, $testee->authorizations());
}
$this->assertEquals($authorizations, $testee->authorizations());
}
public function testCaptures()
{
$capture = \Mockery::mock(Capture::class);
$captures = [$capture];
$testee = new Payments([], $captures);
$this->assertEquals($captures, $testee->captures());
}
public function testToArray()
{
@ -27,9 +36,17 @@ class PaymentsTest extends TestCase
'status' => 'CREATED',
]
);
$capture = \Mockery::mock(Capture::class);
$capture->shouldReceive('to_array')->andReturn(
[
'id' => 'capture',
'status' => 'CREATED',
]
);
$captures = [$capture];
$authorizations = [$authorization];
$testee = new Payments(...$authorizations);
$testee = new Payments($authorizations, $captures);
$this->assertEquals(
[
@ -39,6 +56,12 @@ class PaymentsTest extends TestCase
'status' => 'CREATED',
],
],
'captures' => [
[
'id' => 'capture',
'status' => 'CREATED',
],
],
],
$testee->to_array()
);