| 676 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Srmklive\PayPal\Tests\Unit\Adapter;
|
|
|
4 |
|
|
|
5 |
use Carbon\Carbon;
|
|
|
6 |
use PHPUnit\Framework\TestCase;
|
|
|
7 |
use Srmklive\PayPal\Tests\MockClientClasses;
|
|
|
8 |
use Srmklive\PayPal\Tests\MockResponsePayloads;
|
|
|
9 |
|
|
|
10 |
class ReportingTest extends TestCase
|
|
|
11 |
{
|
|
|
12 |
use MockClientClasses;
|
|
|
13 |
use MockResponsePayloads;
|
|
|
14 |
|
|
|
15 |
/** @test */
|
|
|
16 |
public function it_can_list_transactions()
|
|
|
17 |
{
|
|
|
18 |
$expectedResponse = $this->mockListTransactionsResponse();
|
|
|
19 |
|
|
|
20 |
$expectedMethod = 'listTransactions';
|
|
|
21 |
|
|
|
22 |
$mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
|
|
|
23 |
|
|
|
24 |
$mockClient->setApiCredentials($this->getMockCredentials());
|
|
|
25 |
$mockClient->getAccessToken();
|
|
|
26 |
|
|
|
27 |
$filters = [
|
|
|
28 |
'start_date' => Carbon::now()->toIso8601String(),
|
|
|
29 |
'end_date' => Carbon::now()->subDays(30)->toIso8601String(),
|
|
|
30 |
];
|
|
|
31 |
|
|
|
32 |
$this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}($filters));
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
/** @test */
|
|
|
36 |
public function it_can_list_balances()
|
|
|
37 |
{
|
|
|
38 |
$expectedResponse = $this->mockListBalancesResponse();
|
|
|
39 |
|
|
|
40 |
$expectedMethod = 'listBalances';
|
|
|
41 |
|
|
|
42 |
$mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
|
|
|
43 |
|
|
|
44 |
$mockClient->setApiCredentials($this->getMockCredentials());
|
|
|
45 |
$mockClient->getAccessToken();
|
|
|
46 |
|
|
|
47 |
$this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('2016-10-15T06:07:00-0700'));
|
|
|
48 |
}
|
|
|
49 |
}
|