Skip to content

Commit 681a456

Browse files
committed
add tests
1 parent 477a29c commit 681a456

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

tests/Clients/CreditNoteTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,29 @@ public function testFileContent(): void
184184
$this->assertInstanceOf(ResponseInterface::class, $response);
185185

186186
$this->assertEquals('GET', $api->getRequest()->getMethod());
187+
$this->assertEquals(
188+
'*/*',
189+
$api->getRequest()->getHeaderLine('Accept')
190+
);
191+
$this->assertEquals(
192+
$api->apiUrl . '/v1/credit-notes/resource-id/file',
193+
$api->getRequest()->getUri()->__toString()
194+
);
195+
}
196+
197+
public function testFileContentWithAcceptHeader(): void
198+
{
199+
[$api, $stub] = $this->createClientMockObject(CreditNote::class);
200+
201+
$response = $stub->file('resource-id', 'application/xml');
202+
203+
$this->assertInstanceOf(ResponseInterface::class, $response);
204+
205+
$this->assertEquals('GET', $api->getRequest()->getMethod());
206+
$this->assertEquals(
207+
'application/xml',
208+
$api->getRequest()->getHeaderLine('Accept')
209+
);
187210
$this->assertEquals(
188211
$api->apiUrl . '/v1/credit-notes/resource-id/file',
189212
$api->getRequest()->getUri()->__toString()

tests/Clients/DownPaymentInvoiceTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,29 @@ public function testFileContent(): void
9999
$this->assertInstanceOf(ResponseInterface::class, $response);
100100

101101
$this->assertEquals('GET', $api->getRequest()->getMethod());
102+
$this->assertEquals(
103+
'*/*',
104+
$api->getRequest()->getHeaderLine('Accept')
105+
);
106+
$this->assertEquals(
107+
$api->apiUrl . '/v1/down-payment-invoices/resource-id/file',
108+
$api->getRequest()->getUri()->__toString()
109+
);
110+
}
111+
112+
public function testFileContentWithAcceptHeader(): void
113+
{
114+
[$api, $stub] = $this->createClientMockObject(DownPaymentInvoice::class);
115+
116+
$response = $stub->file('resource-id', 'application/xml');
117+
118+
$this->assertInstanceOf(ResponseInterface::class, $response);
119+
120+
$this->assertEquals('GET', $api->getRequest()->getMethod());
121+
$this->assertEquals(
122+
'application/xml',
123+
$api->getRequest()->getHeaderLine('Accept')
124+
);
102125
$this->assertEquals(
103126
$api->apiUrl . '/v1/down-payment-invoices/resource-id/file',
104127
$api->getRequest()->getUri()->__toString()

tests/Clients/InvoiceTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,33 @@ public function testFileContent(): void
184184
$this->assertInstanceOf(ResponseInterface::class, $response);
185185

186186
$this->assertEquals('GET', $api->getRequest()->getMethod());
187+
$this->assertEquals(
188+
'*/*',
189+
$api->getRequest()->getHeaderLine('Accept')
190+
);
191+
$this->assertEquals(
192+
$api->apiUrl . '/v1/invoices/resource-id/file',
193+
$api->getRequest()->getUri()->__toString()
194+
);
195+
}
196+
197+
public function testFileContentWithAcceptHeader(): void
198+
{
199+
[$api, $stub] = $this->createClientMockObject(Invoice::class);
200+
201+
$response = $stub->file('resource-id', 'application/xml');
202+
203+
$this->assertInstanceOf(ResponseInterface::class, $response);
204+
205+
$this->assertEquals('GET', $api->getRequest()->getMethod());
206+
$this->assertEquals(
207+
'application/xml',
208+
$api->getRequest()->getHeaderLine('Accept')
209+
);
187210
$this->assertEquals(
188211
$api->apiUrl . '/v1/invoices/resource-id/file',
189212
$api->getRequest()->getUri()->__toString()
190213
);
191214
}
215+
192216
}

0 commit comments

Comments
 (0)