mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added tests for XINvoice
This commit is contained in:
parent
0a9d9f370f
commit
8d057bb10d
61
tests/Unit/XInvoiceTest.php
Normal file
61
tests/Unit/XInvoiceTest.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
use App\Jobs\Entity\CreateEntityPdf;
|
||||||
|
use App\Jobs\Invoice\CreateXInvoice;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||||
|
use Tests\MockAccountData;
|
||||||
|
use Tests\TestCase;
|
||||||
|
use horstoeko\zugferd\ZugferdDocumentReader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @covers App\Jobs\Invoice\CreateUbl
|
||||||
|
*/
|
||||||
|
class XInvoiceTest extends TestCase
|
||||||
|
{
|
||||||
|
use MockAccountData;
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
protected function setUp() :void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user