From 4b546bb2064c73ac18faec03e0153e63cf53c156 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 7 Jun 2024 12:02:33 +1000 Subject: [PATCH] Fixes for tests --- composer.lock | 8 ++++---- tests/Feature/EInvoice/FatturaPATest.php | 15 ++++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 5ead7513b0f6..cfbd57ff5c48 100644 --- a/composer.lock +++ b/composer.lock @@ -5076,12 +5076,12 @@ "source": { "type": "git", "url": "https://github.com/invoiceninja/einvoice.git", - "reference": "5ada5e64ee84137dbd5736e4b1c8da7661a8dc97" + "reference": "dd2a36b9efce85cf58d3bb1d718d75f2395c8761" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/5ada5e64ee84137dbd5736e4b1c8da7661a8dc97", - "reference": "5ada5e64ee84137dbd5736e4b1c8da7661a8dc97", + "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/dd2a36b9efce85cf58d3bb1d718d75f2395c8761", + "reference": "dd2a36b9efce85cf58d3bb1d718d75f2395c8761", "shasum": "" }, "require": { @@ -5123,7 +5123,7 @@ "source": "https://github.com/invoiceninja/einvoice/tree/main", "issues": "https://github.com/invoiceninja/einvoice/issues" }, - "time": "2024-06-07T01:16:28+00:00" + "time": "2024-06-07T02:01:13+00:00" }, { "name": "invoiceninja/inspector", diff --git a/tests/Feature/EInvoice/FatturaPATest.php b/tests/Feature/EInvoice/FatturaPATest.php index 044784f8658c..d69b60f2bc16 100644 --- a/tests/Feature/EInvoice/FatturaPATest.php +++ b/tests/Feature/EInvoice/FatturaPATest.php @@ -126,20 +126,25 @@ class FatturaPATest extends TestCase $this->assertInstanceOf(FatturaElettronicaBody::class, $fe->FatturaElettronicaBody[0]); $this->assertInstanceOf(FatturaElettronicaHeader::class, $fe->FatturaElettronicaHeader); - $e = new EInvoice; $errors = $e->validate($fe); if(count($errors) > 0) nlog($errors); - + $this->assertCount(0, $errors); - $encoder = new Encode($fe); - $xml = $encoder->toXml(); - + $xml = $e->encode($fe, 'xml'); $this->assertNotNull($xml); + nlog($xml); + $json = $e->encode($fe, 'json'); + $this->assertNotNull($json); + nlog($json); + + $decode = $e->decode('FatturaPA', $json, 'json'); + + $this->assertInstanceOf(FatturaElettronica::class, $decode); } }