Skip to content

Commit

Permalink
Added more validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Nov 8, 2024
1 parent a7161b9 commit 104548f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions tests/testcases/CiiToUblSimpleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function testLoadAndConvert(): void
{
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/1_cii_simple.xml")->enableAutomaticMode()->convert();
$this->assertNotNull(self::$document);
$this->assertNotFalse($this->saveFinalXmlToBuildResults('1_cii_simple_as_ubl.xml'));
}

public function testDocumentGeneral(): void
Expand Down
1 change: 1 addition & 0 deletions tests/testcases/CiiToUblTechnical1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function testLoadAndConvert(): void
{
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/3_cii_technical_1.xml")->enableAutomaticMode()->convert();
$this->assertNotNull(self::$document);
$this->assertNotFalse($this->saveFinalXmlToBuildResults('3_cii_technical_1_as_ubl.xml'));
}

public function testDocumentGeneral(): void
Expand Down
5 changes: 3 additions & 2 deletions tests/testcases/CiiToUblTechnical2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function testLoadAndConvert(): void
{
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/3_cii_technical_2.xml")->enableAutomaticMode()->convert();
$this->assertNotNull(self::$document);
$this->assertNotFalse($this->saveFinalXmlToBuildResults('3_cii_technical_2_as_ubl.xml'));
}

public function testDocumentGeneral(): void
Expand Down Expand Up @@ -41,11 +42,11 @@ public function testDocumentGeneral(): void
$this->assertXPathNotExists('/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID');
$this->assertXPathNotExists('/ubl:Invoice/cac:ReceiptDocumentReference/cbc:ID');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 0, '01_15_Anhang_01');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0, '916');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentDescription', 0, 'Aufschlüsselung der einzelnen Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 0);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 1, '01_15_Anhang_02');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1, '916');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentDescription', 1, 'Gesamtübersicht der Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 1);
$this->assertXPathNotExists('/ubl:Invoice/cac:OriginatorDocumentReference/cbc:ID');
Expand Down
3 changes: 2 additions & 1 deletion tests/testcases/CiiToUblTechnical3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function testLoadAndConvert(): void
{
self::$document = XmlConverterCiiToUbl::fromFile(dirname(__FILE__) . "/../assets/cii/3_cii_technical_3.xml")->enableAutomaticMode()->convert();
$this->assertNotNull(self::$document);
$this->assertNotFalse($this->saveFinalXmlToBuildResults('3_cii_technical_3_as_ubl.xml'));
}

public function testDocumentGeneral(): void
Expand Down Expand Up @@ -41,7 +42,7 @@ public function testDocumentGeneral(): void
$this->assertXPathNotExists('/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID');
$this->assertXPathNotExists('/ubl:Invoice/cac:ReceiptDocumentReference/cbc:ID');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 0, '01_15_Anhang_01.pdf');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0, '916');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentDescription', 0, 'Aufschlüsselung der einzelnen Leistungspositionen');
$this->assertXPathValueStartsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject', 0, 'JVBERi0xLjUNCiW1tbW1D');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 1);
Expand Down
4 changes: 2 additions & 2 deletions tests/testcases/CiiToUblTechnical5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function testDocumentGeneral(): void
$this->assertXPathNotExists('/ubl:CreditNote/cac:DespatchDocumentReference/cbc:ID');
$this->assertXPathNotExists('/ubl:CreditNote/cac:ReceiptDocumentReference/cbc:ID');
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:ID', 0, '01_15_Anhang_01');
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1, '916');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0);
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentDescription', 0, 'Aufschlüsselung der einzelnen Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 0);
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:ID', 1, '01_15_Anhang_02');
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1, '916');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1);
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentDescription', 1, 'Gesamtübersicht der Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 1);
$this->assertXPathNotExists('/ubl:CreditNote/cac:OriginatorDocumentReference/cbc:ID');
Expand Down

0 comments on commit 104548f

Please sign in to comment.