Skip to content

Commit

Permalink
Made tests ready for PHPUnit10
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Feb 13, 2023
1 parent f4a31a6 commit abd5d7f
Show file tree
Hide file tree
Showing 20 changed files with 603 additions and 424 deletions.
10 changes: 5 additions & 5 deletions tests/BuilderEn16931Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public static function setUpBeforeClass(): void

public function testDocumentProfile(): void
{
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_EXTENDED, self::$document->profile);
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_EXTENDED, self::$document->profileId);
}

public function testXmlGenerals(): void
Expand All @@ -29,7 +29,7 @@ public function testXmlGenerals(): void
$this->disableRenderXmlContent();
$this->assertArrayHasKey("rsm", $namespaces);
$this->assertArrayHasKey("ram", $namespaces);
$this->assertXPathValue('/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID', (self::$document)->profiledef["contextparameter"]);
$this->assertXPathValue('/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID', (self::$document)->profileDefinition["contextparameter"]);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions tests/BuilderExtendedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public static function setUpBeforeClass(): void

public function testDocumentProfile(): void
{
$this->assertNotEquals(ZugferdProfiles::PROFILE_EN16931, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, self::$document->profile);
$this->assertEquals(ZugferdProfiles::PROFILE_EXTENDED, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_EN16931, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, self::$document->profileId);
$this->assertEquals(ZugferdProfiles::PROFILE_EXTENDED, self::$document->profileId);
}

public function testXmlGenerals(): void
Expand All @@ -29,7 +29,7 @@ public function testXmlGenerals(): void
$this->disableRenderXmlContent();
$this->assertArrayHasKey("rsm", $namespaces);
$this->assertArrayHasKey("ram", $namespaces);
$this->assertXPathValue('/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID', (self::$document)->profiledef["contextparameter"]);
$this->assertXPathValue('/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID', (self::$document)->profileDefinition["contextparameter"]);
}

/**
Expand Down
40 changes: 20 additions & 20 deletions tests/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public function testDocumentCreationBasic(): void
{
$doc = new ZugferdDocument(ZugferdProfiles::PROFILE_BASIC);
$this->assertNotNull($doc);
$this->assertEquals(ZugferdProfiles::PROFILE_BASIC, $doc->profile);
$this->assertArrayHasKey("contextparameter", $doc->profiledef);
$this->assertArrayHasKey("name", $doc->profiledef);
$this->assertEquals("urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic", $doc->profiledef["contextparameter"]);
$this->assertEquals("basic", $doc->profiledef["name"]);
$this->assertEquals(ZugferdProfiles::PROFILE_BASIC, $doc->profileId);
$this->assertArrayHasKey("contextparameter", $doc->profileDefinition);
$this->assertArrayHasKey("name", $doc->profileDefinition);
$this->assertEquals("urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic", $doc->profileDefinition["contextparameter"]);
$this->assertEquals("basic", $doc->profileDefinition["name"]);
}

/**
Expand All @@ -30,11 +30,11 @@ public function testDocumentCreationBasicWl(): void
{
$doc = new ZugferdDocument(ZugferdProfiles::PROFILE_BASICWL);
$this->assertNotNull($doc);
$this->assertEquals(ZugferdProfiles::PROFILE_BASICWL, $doc->profile);
$this->assertArrayHasKey("contextparameter", $doc->profiledef);
$this->assertArrayHasKey("name", $doc->profiledef);
$this->assertEquals("urn:factur-x.eu:1p0:basicwl", $doc->profiledef["contextparameter"]);
$this->assertEquals("basicwl", $doc->profiledef["name"]);
$this->assertEquals(ZugferdProfiles::PROFILE_BASICWL, $doc->profileId);
$this->assertArrayHasKey("contextparameter", $doc->profileDefinition);
$this->assertArrayHasKey("name", $doc->profileDefinition);
$this->assertEquals("urn:factur-x.eu:1p0:basicwl", $doc->profileDefinition["contextparameter"]);
$this->assertEquals("basicwl", $doc->profileDefinition["name"]);
}

/**
Expand All @@ -44,11 +44,11 @@ public function testDocumentCreationEn16931(): void
{
$doc = new ZugferdDocument(ZugferdProfiles::PROFILE_EN16931);
$this->assertNotNull($doc);
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, $doc->profile);
$this->assertArrayHasKey("contextparameter", $doc->profiledef);
$this->assertArrayHasKey("name", $doc->profiledef);
$this->assertEquals("urn:cen.eu:en16931:2017", $doc->profiledef["contextparameter"]);
$this->assertEquals("en16931", $doc->profiledef["name"]);
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, $doc->profileId);
$this->assertArrayHasKey("contextparameter", $doc->profileDefinition);
$this->assertArrayHasKey("name", $doc->profileDefinition);
$this->assertEquals("urn:cen.eu:en16931:2017", $doc->profileDefinition["contextparameter"]);
$this->assertEquals("en16931", $doc->profileDefinition["name"]);
}

/**
Expand All @@ -58,11 +58,11 @@ public function testDocumentCreationExtended(): void
{
$doc = new ZugferdDocument(ZugferdProfiles::PROFILE_EXTENDED);
$this->assertNotNull($doc);
$this->assertEquals(ZugferdProfiles::PROFILE_EXTENDED, $doc->profile);
$this->assertArrayHasKey("contextparameter", $doc->profiledef);
$this->assertArrayHasKey("name", $doc->profiledef);
$this->assertEquals("urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended", $doc->profiledef["contextparameter"]);
$this->assertEquals("extended", $doc->profiledef["name"]);
$this->assertEquals(ZugferdProfiles::PROFILE_EXTENDED, $doc->profileId);
$this->assertArrayHasKey("contextparameter", $doc->profileDefinition);
$this->assertArrayHasKey("name", $doc->profileDefinition);
$this->assertEquals("urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended", $doc->profileDefinition["contextparameter"]);
$this->assertEquals("extended", $doc->profileDefinition["name"]);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions tests/PdfBuilderEn16931Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public function testReadPdf(): void
$document = ZugferdDocumentPdfReader::readAndGuessFromFile(self::$destPdfFilename);

$this->assertNotNull($document);
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, $document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, $document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, $document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_EXTENDED, $document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_XRECHNUNG, $document->profile);
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, $document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, $document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, $document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_EXTENDED, $document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_XRECHNUNG, $document->profileId);
}
}
85 changes: 50 additions & 35 deletions tests/PdfReaderEn16931AllowanceChargeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public function testCanReadPdf(): void

public function testDocumentProfile(): void
{
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_EXTENDED, self::$document->profile);
$this->assertNotEquals(ZugferdProfiles::PROFILE_XRECHNUNG, self::$document->profile);
$this->assertEquals(ZugferdProfiles::PROFILE_EN16931, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASIC, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_BASICWL, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_EXTENDED, self::$document->profileId);
$this->assertNotEquals(ZugferdProfiles::PROFILE_XRECHNUNG, self::$document->profileId);
}

/**
Expand Down Expand Up @@ -223,8 +223,9 @@ public function testDocumentSellerContact(): void
{
$this->assertFalse(self::$document->firstDocumentSellerContact());
$this->assertFalse(self::$document->nextDocumentSellerContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentSellerContact($sellercontactpersonname, $sellercontactdepartmentname, $sellercontactphoneno, $sellercontactfaxno, $sellercontactemailaddr);
$this->expectNoticeOrWarningExt(function () {
self::$document->getDocumentSellerContact($sellercontactpersonname, $sellercontactdepartmentname, $sellercontactphoneno, $sellercontactfaxno, $sellercontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -297,8 +298,9 @@ public function testDocumentBuyerContact(): void
{
$this->assertFalse(self::$document->firstDocumentBuyerContact());
$this->assertFalse(self::$document->nextDocumentBuyerContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentBuyerContact($buyercontactpersonname, $buyercontactdepartmentname, $buyercontactphoneno, $buyercontactfaxno, $buyercontactemailaddr);
$this->expectNoticeOrWarningExt(function () {
self::$document->getDocumentBuyerContact($buyercontactpersonname, $buyercontactdepartmentname, $buyercontactphoneno, $buyercontactfaxno, $buyercontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -369,8 +371,9 @@ public function testDocumentSellerTaxRepresentativeContact(): void
{
$this->assertFalse(self::$document->firstDocumentSellerTaxRepresentativeContact());
$this->assertFalse(self::$document->nextDocumentSellerTaxRepresentativeContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentSellerTaxRepresentativeContact($sellertaxreprcontactpersonname, $sellertaxreprcontactdepartmentname, $sellertaxreprcontactphoneno, $sellertaxreprcontactfaxno, $sellertaxreprcontactemailaddr);
$this->expectNoticeOrWarningExt(function () {
self::$document->getDocumentSellerTaxRepresentativeContact($sellertaxreprcontactpersonname, $sellertaxreprcontactdepartmentname, $sellertaxreprcontactphoneno, $sellertaxreprcontactfaxno, $sellertaxreprcontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -441,8 +444,9 @@ public function testDocumentShipToContact(): void
{
$this->assertFalse(self::$document->firstDocumentShipToContact());
$this->assertFalse(self::$document->nextDocumentShipToContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentShipToContact($shiptocontactpersonname, $shiptocontactdepartmentname, $shiptocontactphoneno, $shiptocontactfaxno, $shiptocontactemailaddr);
$this->expectNoticeOrWarningExt(function () {
self::$document->getDocumentShipToContact($shiptocontactpersonname, $shiptocontactdepartmentname, $shiptocontactphoneno, $shiptocontactfaxno, $shiptocontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -512,11 +516,13 @@ public function testDocumentUltimateShipToLegalOrganization(): void
public function testDocumentUltimateShipToContact(): void
{
$this->assertFalse(self::$document->firstDocumentUltimateShipToContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentUltimateShipToContact($ultimateshiptocontactpersonname, $ultimateshiptocontactdepartmentname, $ultimateshiptocontactphoneno, $ultimateshiptocontactfaxno, $ultimateshiptocontactemailaddr);
$this->expectNoticeOrWarningExt(function () {
self::$document->getDocumentUltimateShipToContact($ultimateshiptocontactpersonname, $ultimateshiptocontactdepartmentname, $ultimateshiptocontactphoneno, $ultimateshiptocontactfaxno, $ultimateshiptocontactemailaddr);
});
$this->assertFalse(self::$document->nextDocumentUltimateShipToContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentUltimateShipToContact($ultimateshiptocontactpersonname, $ultimateshiptocontactdepartmentname, $ultimateshiptocontactphoneno, $ultimateshiptocontactfaxno, $ultimateshiptocontactemailaddr);
$this->expectNoticeOrWarningExt(function () {
self::$document->getDocumentUltimateShipToContact($ultimateshiptocontactpersonname, $ultimateshiptocontactdepartmentname, $ultimateshiptocontactphoneno, $ultimateshiptocontactfaxno, $ultimateshiptocontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -586,11 +592,13 @@ public function testDocumentShipFromLegalOrganization(): void
public function testDocumentShipFromContact(): void
{
$this->assertFalse(self::$document->firstDocumentShipFromContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentShipFromContact($shipfromcontactpersonname, $shipfromcontactdepartmentname, $shipfromcontactphoneno, $shipfromcontactfaxno, $shipfromcontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentShipFromContact($shipfromcontactpersonname, $shipfromcontactdepartmentname, $shipfromcontactphoneno, $shipfromcontactfaxno, $shipfromcontactemailaddr);
});
$this->assertFalse(self::$document->nextDocumentShipFromContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentShipFromContact($shipfromcontactpersonname, $shipfromcontactdepartmentname, $shipfromcontactphoneno, $shipfromcontactfaxno, $shipfromcontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentShipFromContact($shipfromcontactpersonname, $shipfromcontactdepartmentname, $shipfromcontactphoneno, $shipfromcontactfaxno, $shipfromcontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -660,11 +668,13 @@ public function testDocumentInvoicerLegalOrganization(): void
public function testDocumentInvoicerContact(): void
{
$this->assertFalse(self::$document->firstDocumentInvoicerContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentInvoicerContact($invoicercontactpersonname, $invoicercontactdepartmentname, $invoicercontactphoneno, $invoicercontactfaxno, $invoicercontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentInvoicerContact($invoicercontactpersonname, $invoicercontactdepartmentname, $invoicercontactphoneno, $invoicercontactfaxno, $invoicercontactemailaddr);
});
$this->assertFalse(self::$document->nextDocumentInvoicerContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentInvoicerContact($invoicercontactpersonname, $invoicercontactdepartmentname, $invoicercontactphoneno, $invoicercontactfaxno, $invoicercontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentInvoicerContact($invoicercontactpersonname, $invoicercontactdepartmentname, $invoicercontactphoneno, $invoicercontactfaxno, $invoicercontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -734,11 +744,13 @@ public function testDocumentInvoiceeLegalOrganization(): void
public function testDocumentInvoiceeContact(): void
{
$this->assertFalse(self::$document->firstDocumentInvoiceeContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentInvoiceeContact($invoiceecontactpersonname, $invoiceecontactdepartmentname, $invoiceecontactphoneno, $invoiceecontactfaxno, $invoiceecontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentInvoiceeContact($invoiceecontactpersonname, $invoiceecontactdepartmentname, $invoiceecontactphoneno, $invoiceecontactfaxno, $invoiceecontactemailaddr);
});
$this->assertFalse(self::$document->nextDocumentInvoiceeContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentInvoiceeContact($invoiceecontactpersonname, $invoiceecontactdepartmentname, $invoiceecontactphoneno, $invoiceecontactfaxno, $invoiceecontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentInvoiceeContact($invoiceecontactpersonname, $invoiceecontactdepartmentname, $invoiceecontactphoneno, $invoiceecontactfaxno, $invoiceecontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -808,11 +820,13 @@ public function testDocumentPayeeLegalOrganization(): void
public function testDocumentPayeeContact(): void
{
$this->assertFalse(self::$document->firstDocumentPayeeContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentPayeeContact($payeecontactpersonname, $payeecontactdepartmentname, $payeecontactphoneno, $payeecontactfaxno, $payeecontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentPayeeContact($payeecontactpersonname, $payeecontactdepartmentname, $payeecontactphoneno, $payeecontactfaxno, $payeecontactemailaddr);
});
$this->assertFalse(self::$document->nextDocumentPayeeContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentPayeeContact($payeecontactpersonname, $payeecontactdepartmentname, $payeecontactphoneno, $payeecontactfaxno, $payeecontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentPayeeContact($payeecontactpersonname, $payeecontactdepartmentname, $payeecontactphoneno, $payeecontactfaxno, $payeecontactemailaddr);
});
}

/**
Expand Down Expand Up @@ -887,8 +901,9 @@ public function testDocumentProductEndUserLegalOrganization(): void
public function testDocumentProductEndUserContact(): void
{
$this->assertFalse(self::$document->firstDocumentProductEndUserContactContact());
$this->expectNoticeOrWarning();
self::$document->getDocumentProductEndUserContact($producendusercontactpersonname, $producendusercontactdepartmentname, $producendusercontactphoneno, $producendusercontactfaxno, $producendusercontactemailaddr);
$this->expectNoticeOrWarningExt(function() {
self::$document->getDocumentProductEndUserContact($producendusercontactpersonname, $producendusercontactdepartmentname, $producendusercontactphoneno, $producendusercontactfaxno, $producendusercontactemailaddr);
});
$this->assertFalse(self::$document->nextDocumentProductEndUserContactContact());
}

Expand Down
Loading

0 comments on commit abd5d7f

Please sign in to comment.