-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from horstoeko/Issue_43
Added Test for Issue #43
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace horstoeko\zugferd\tests\testcases\issues; | ||
|
||
use horstoeko\zugferd\tests\TestCase; | ||
use horstoeko\zugferd\ZugferdProfiles; | ||
use horstoeko\zugferd\ZugferdDocumentBuilder; | ||
use horstoeko\zugferd\codelists\ZugferdInvoiceType; | ||
use horstoeko\zugferd\tests\traits\HandlesXmlTests; | ||
|
||
class Issue43Test extends TestCase | ||
{ | ||
use HandlesXmlTests; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
self::$document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_2_2); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @issue 43 | ||
*/ | ||
public function testIssue(): void | ||
{ | ||
$date = "05.05.24"; | ||
$duedate = "05.06.24"; | ||
$invoice = "Invoice123"; | ||
|
||
self::$document->setDocumentInformation( | ||
$invoice, | ||
ZugferdInvoiceType::INVOICE, | ||
\DateTime::createFromFormat("d.m.y", $date), | ||
"EUR", | ||
$invoice, | ||
null, | ||
\DateTime::createFromFormat("d.m.y", $duedate) | ||
); | ||
|
||
self::$document->addDocumentPaymentTerm('PaymentTerm', \DateTime::createFromFormat("d.m.y", $duedate), "MandateId"); | ||
|
||
$this->assertXPathValueWithAttribute('/rsm:CrossIndustryInvoice/rsm:ExchangedDocument/ram:IssueDateTime/udt:DateTimeString', "20240505", "format", "102"); | ||
$this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:DueDateDateTime/udt:DateTimeString', 0, "20240605", "format", "102"); | ||
} | ||
} |