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); + } +}