Skip to content

Commit

Permalink
Merge pull request #44 from horstoeko/Issue_43
Browse files Browse the repository at this point in the history
Added Test for Issue #43
  • Loading branch information
horstoeko authored May 7, 2024
2 parents 00d4c79 + 5ed8d50 commit 63d794b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<file>../tests/testcases/issues/Issue10Test.php</file>
<file>../tests/testcases/issues/Issue18Test.php</file>
<file>../tests/testcases/issues/Issue32Test.php</file>
<file>../tests/testcases/issues/Issue43Test.php</file>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
Expand Down
48 changes: 48 additions & 0 deletions tests/testcases/issues/Issue43Test.php
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");
}
}

0 comments on commit 63d794b

Please sign in to comment.