-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExportsTest.php
More file actions
119 lines (104 loc) · 4.21 KB
/
ExportsTest.php
File metadata and controls
119 lines (104 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
namespace Tests\Services;
use Increase\Client;
use Increase\Exports\Export;
use Increase\Page;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
/**
* @internal
*/
#[CoversNothing]
final class ExportsTest extends TestCase
{
protected Client $client;
protected function setUp(): void
{
parent::setUp();
$testUrl = getenv('TEST_API_BASE_URL') ?: 'http://127.0.0.1:4010';
$client = new Client(apiKey: 'My API Key', baseUrl: $testUrl);
$this->client = $client;
}
#[Test]
public function testCreate(): void
{
$result = $this->client->exports->create(category: 'transaction_csv');
// @phpstan-ignore-next-line method.alreadyNarrowedType
$this->assertInstanceOf(Export::class, $result);
}
#[Test]
public function testCreateWithOptionalParams(): void
{
$result = $this->client->exports->create(
category: 'transaction_csv',
accountStatementBai2: [
'accountID' => 'account_id',
'effectiveDate' => '2019-12-27',
'programID' => 'program_id',
],
accountStatementOfx: [
'accountID' => 'account_id',
'createdAt' => [
'after' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'before' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrAfter' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrBefore' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
],
],
accountVerificationLetter: [
'accountNumberID' => 'account_number_id', 'balanceDate' => '2019-12-27',
],
balanceCsv: [
'accountID' => 'account_id',
'createdAt' => [
'after' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'before' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrAfter' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrBefore' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
],
],
bookkeepingAccountBalanceCsv: [
'bookkeepingAccountID' => 'bookkeeping_account_id',
'createdAt' => [
'after' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'before' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrAfter' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrBefore' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
],
],
entityCsv: [],
fundingInstructions: ['accountNumberID' => 'account_number_id'],
transactionCsv: [
'accountID' => 'account_in71c4amph0vgo2qllky',
'createdAt' => [
'after' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'before' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrAfter' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'onOrBefore' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
],
],
vendorCsv: [],
);
// @phpstan-ignore-next-line method.alreadyNarrowedType
$this->assertInstanceOf(Export::class, $result);
}
#[Test]
public function testRetrieve(): void
{
$result = $this->client->exports->retrieve('export_8s4m48qz3bclzje0zwh9');
// @phpstan-ignore-next-line method.alreadyNarrowedType
$this->assertInstanceOf(Export::class, $result);
}
#[Test]
public function testList(): void
{
$page = $this->client->exports->list();
// @phpstan-ignore-next-line method.alreadyNarrowedType
$this->assertInstanceOf(Page::class, $page);
if ($item = $page->getItems()[0] ?? null) {
// @phpstan-ignore-next-line method.alreadyNarrowedType
$this->assertInstanceOf(Export::class, $item);
}
}
}