From 8d057bb10df2aef2b2f688600e0abd4135ce90d5 Mon Sep 17 00:00:00 2001 From: Lars Kusch Date: Thu, 6 Apr 2023 11:08:59 +0200 Subject: [PATCH] Added tests for XINvoice --- tests/Unit/XInvoiceTest.php | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/Unit/XInvoiceTest.php diff --git a/tests/Unit/XInvoiceTest.php b/tests/Unit/XInvoiceTest.php new file mode 100644 index 000000000000..cfe93649328f --- /dev/null +++ b/tests/Unit/XInvoiceTest.php @@ -0,0 +1,61 @@ +withoutMiddleware( + ThrottleRequests::class + ); + $this->makeTestData(); + } + + public function testXInvoiceGenerates() + { + $xinvoice = (new CreateXInvoice($this->invoice, false))->handle(); + $this->assertNotNull($xinvoice); + $this->assertFileExists($xinvoice); + } + + public function testValidityofXMLFile() + { + $xinvoice = (new CreateXInvoice($this->invoice, false))->handle(); + $document = ZugferdDocumentReader::readAndGuessFromFile($xinvoice); + $document ->getDocumentInformation($documentno); + $this->assertEquals($this->invoice->number, $documentno); + } + public function checkEmbededPDFFile() + { + $pdf = (new CreateEntityPdf($this->invoice->invitations()->first())); + (new CreateXInvoice($this->invoice, true, $pdf))->handle(); + $document = ZugferdDocumentReader::readAndGuessFromFile($pdf); + $document ->getDocumentInformation($documentno); + $this->assertEquals($this->invoice->number, $documentno); + } +}