-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add method to handle empty receptionEmails in Response
Enhanced the Response model to handle cases where receptionEmails is empty by setting it to a new ReceptionEmails object. Added corresponding XML stub and test case to validate this change. Fixed a potential issue in TypeArray's count method by providing a default empty array.
- Loading branch information
Showing
4 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ResponseDoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<response> | ||
<index>1</index> | ||
<invoiceUid>6F825B9B74717280D1F9A38252D0B65604C6D162</invoiceUid> | ||
<invoiceMark>480301204040191</invoiceMark> | ||
<qrUrl>https://mydataapidev.aade.gr/TimologioQR/QRInfo?q=sSsxThUx5i3O8ankrp8XUDiL0q12vbzuWZP0nEfMgAyQ2nbm7s6vSz3CYYcmod6i0uCrPCvSLrQ5N1qxEHF8JsfMNz6NmibNhBNXJiR8ecC%3d</qrUrl> | ||
<statusCode>Success</statusCode> | ||
<receptionEmails/> | ||
</response> | ||
</ResponseDoc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,21 @@ public function test_it_reads_response_correctly() | |
$this->assertEquals("[email protected]", $doc[0]->getReceptionEmails()->offsetGet(1)); | ||
} | ||
|
||
public function test_it_reads_response_with_empty_reception_emails_correctly() | ||
{ | ||
$doc = $this->getResponseDocFromXml('response-doc-with-empty-reception-emails'); | ||
|
||
$this->assertCount(1, $doc); | ||
$this->assertEquals(1, $doc[0]->getIndex()); | ||
$this->assertEquals("6F825B9B74717280D1F9A38252D0B65604C6D162", $doc[0]->getInvoiceUid()); | ||
$this->assertEquals("480301204040191", $doc[0]->getInvoiceMark()); | ||
$this->assertEquals("https://mydataapidev.aade.gr/TimologioQR/QRInfo?q=sSsxThUx5i3O8ankrp8XUDiL0q12vbzuWZP0nEfMgAyQ2nbm7s6vSz3CYYcmod6i0uCrPCvSLrQ5N1qxEHF8JsfMNz6NmibNhBNXJiR8ecC%3d", $doc[0]->getQrUrl()); | ||
$this->assertEquals("Success", $doc[0]->getStatusCode()); | ||
|
||
$this->assertIsArray($doc[0]->getReceptionEmails()->all()); | ||
$this->assertCount(0, $doc[0]->getReceptionEmails()); | ||
} | ||
|
||
public function test_it_reads_errors_correctly() | ||
{ | ||
$doc = $this->getResponseDocFromXml('response-doc-with-errors'); | ||
|