-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathVoucherListTest.php
More file actions
56 lines (42 loc) · 1.68 KB
/
VoucherListTest.php
File metadata and controls
56 lines (42 loc) · 1.68 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
<?php
declare(strict_types=1);
namespace Sysix\LexOffice\Tests\Clients;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Sysix\LexOffice\Clients\VoucherList;
use Sysix\LexOffice\Tests\TestClient;
final class VoucherListTest extends TestClient
{
public function testGetPage(): void
{
[$api, $stub] = $this->createClientMockObject(VoucherList::class);
$stub->types = ['invoice'];
$stub->statuses = ['open'];
$stub->archived = true;
$response = $stub->getPage(0);
$this->assertInstanceOf(ResponseInterface::class, $response);
$this->assertEquals('GET', $api->getRequest()->getMethod());
$this->assertEquals(
$api->apiUrl . '/v1/voucherlist?page=0&voucherType=invoice&voucherStatus=open&archived=1&size=100&sort=voucherNumber%2CDESC',
$api->getRequest()->getUri()->__toString()
);
}
public function testGetAll(): void
{
$this->expectDeprecationV1Warning('getAll');
[$api, $stub] = $this->createClientMultiMockObject(
VoucherList::class,
[new Response(200, [], '{"content": [], "totalPages": 1}')]
);
$stub->types = ['invoice'];
$stub->statuses = ['open'];
$stub->archived = true;
$response = $stub->getAll();
$this->assertInstanceOf(ResponseInterface::class, $response);
$this->assertEquals('GET', $api->getRequest()->getMethod());
$this->assertEquals(
$api->apiUrl . '/v1/voucherlist?page=0&voucherType=invoice&voucherStatus=open&archived=1&size=100&sort=voucherNumber%2CDESC',
$api->getRequest()->getUri()->__toString()
);
}
}