diff --git a/tests/testcases/PdfBuilderEn16931Test.php b/tests/testcases/PdfBuilderEn16931Test.php index 67bef475..5904b806 100644 --- a/tests/testcases/PdfBuilderEn16931Test.php +++ b/tests/testcases/PdfBuilderEn16931Test.php @@ -194,7 +194,7 @@ public function testPdfMetaData(): void $this->assertEquals("Lieferant GmbH", $pdfDetails["dc:creator"]); $this->assertEquals("FacturX/ZUGFeRD Invoice 471102 dated 2018-03-05 issued by Lieferant GmbH", $pdfDetails["dc:description"]); $this->assertStringContainsString('Factur-X PHP library', $pdfDetails["xmp:creatortool"]); - $this->assertEquals("2018-03-05T00:00:00+00:00", $pdfDetails["xmp:createdate"]); + $this->assertStringContainsString("2018-03-05", $pdfDetails["xmp:createdate"]); $this->assertStringContainsString(date("Y-m-d"), $pdfDetails["xmp:modifydate"]); } @@ -527,4 +527,48 @@ public function testAttachAdditionalFileByContentAllValid(): void $this->assertEquals("EmbeddedFile", $pdfFilespecDetailsEF_UF["Type"]); $this->assertEquals(195, $pdfFilespecDetailsEF_UF["Length"]); } + + public function testDeterministicMode(): void + { + $pdfBuilder = new ZugferdDocumentPdfBuilder(self::$document, self::$sourcePdfFilename); + $pdfBuilder->setDeterministicModeEnabled(true); + $pdfBuilder->generateDocument(); + $pdfBuilder->saveDocument(self::$destPdfFilename); + + $pdfParser = new PdfParser(); + $pdfParsed = $pdfParser->parseFile(self::$destPdfFilename); + $pdfDetails = $pdfParsed->getDetails(); + + $this->assertIsArray($pdfDetails); + $this->assertArrayHasKey("Producer", $pdfDetails); + $this->assertArrayHasKey("CreationDate", $pdfDetails); + $this->assertArrayHasKey("Pages", $pdfDetails); + $this->assertArrayHasKey("fx:documenttype", $pdfDetails); + $this->assertArrayHasKey("fx:documentfilename", $pdfDetails); + $this->assertArrayHasKey("fx:version", $pdfDetails); + $this->assertArrayHasKey("fx:conformancelevel", $pdfDetails); + $this->assertArrayHasKey("pdfaid:part", $pdfDetails); + $this->assertArrayHasKey("pdfaid:conformance", $pdfDetails); + $this->assertArrayHasKey("dc:title", $pdfDetails); + $this->assertArrayHasKey("dc:creator", $pdfDetails); + $this->assertArrayHasKey("dc:description", $pdfDetails); + $this->assertArrayHasKey("xmp:creatortool", $pdfDetails); + $this->assertArrayHasKey("xmp:createdate", $pdfDetails); + $this->assertArrayHasKey("xmp:modifydate", $pdfDetails); + $this->assertStringContainsString('FPDF', $pdfDetails["Producer"]); + $this->assertStringContainsString('2000-01-01', $pdfDetails["CreationDate"]); + $this->assertEquals("1", $pdfDetails["Pages"]); + $this->assertEquals("INVOICE", $pdfDetails["fx:documenttype"]); + $this->assertEquals("factur-x.xml", $pdfDetails["fx:documentfilename"]); + $this->assertEquals("1.0", $pdfDetails["fx:version"]); + $this->assertEquals("EN 16931", $pdfDetails["fx:conformancelevel"]); + $this->assertEquals("3", $pdfDetails["pdfaid:part"]); + $this->assertEquals("B", $pdfDetails["pdfaid:conformance"]); + $this->assertEquals("Lieferant GmbH : Invoice 471102", $pdfDetails["dc:title"]); + $this->assertEquals("Lieferant GmbH", $pdfDetails["dc:creator"]); + $this->assertEquals("FacturX/ZUGFeRD Invoice 471102 dated 2018-03-05 issued by Lieferant GmbH", $pdfDetails["dc:description"]); + $this->assertStringContainsString('Factur-X PHP library', $pdfDetails["xmp:creatortool"]); + $this->assertStringContainsString('2000-01-01', $pdfDetails["xmp:createdate"]); + $this->assertStringContainsString('2000-01-01', $pdfDetails["xmp:modifydate"]); + } }