Skip to content

API reference / Quittio \ Laravel \ Testing

EInvoiceAssertions

final class in quittio/laravel · uses InteractsWithQuittio

Quittio\Laravel\Testing\EInvoiceAssertions · Source

The assertions of {@see InteractsWithQuittio} outside a test case class, e.g. in Pest helper functions: (new EInvoiceAssertions)->assertValidEInvoice($pdf, 'xrechnung').

Methods#

MethodDescription
->__construct()
->assertValidEInvoice()Reads the PDF or XML and validates it with all configured levels.
->assertXmlMatchesSnapshot()Compares XML with a stored snapshot (canonicalised); the first run writes it.
->quittioSnapshotDirectory()
->quittioSnapshotName()
->tearDownInteractsWithQuittio()Called by Laravel's test case after each test: forgets the process-wide state of Quittio (e.g. base rates registered by a test), see Quittio\Core\Quittio::resetState().

__construct()#

public function __construct(string $snapshotDirectory = '')
ParameterTypeDescription
$snapshotDirectorystring = ''

assertValidEInvoice()#

public function assertValidEInvoice(string $pdfOrXml, ?string $profile = null): void

Reads the PDF or XML and validates it with all configured levels.

ParameterTypeDescription
$pdfOrXmlstring
$profile?string = null

assertXmlMatchesSnapshot()#

public function assertXmlMatchesSnapshot(string $xml, ?string $name = null): void

Compares XML with a stored snapshot (canonicalised); the first run writes it.

ParameterTypeDescription
$xmlstring
$name?string = null

quittioSnapshotDirectory()#

protected function quittioSnapshotDirectory(): string

protected

Returns
string

quittioSnapshotName()#

protected function quittioSnapshotName(): string

protected

Returns
string

tearDownInteractsWithQuittio()#

protected function tearDownInteractsWithQuittio(): void

protected

Called by Laravel's test case after each test: forgets the process-wide state of Quittio (e.g. base rates registered by a test), see Quittio\Core\Quittio::resetState().

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.