From bb85d1d21c70e2b9fe8ee29a1f0a8dcade84f51b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 25 Nov 2024 14:25:55 +1100 Subject: [PATCH] Fixes for tests --- app/Models/Client.php | 3 +++ .../Einvoice/Storecove/EInvoiceValidationTest.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Models/Client.php b/app/Models/Client.php index f27f828d98..b7c16591e3 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -1047,6 +1047,9 @@ class Client extends BaseModel implements HasLocalePreference public function checkDeliveryNetwork(): ?string { + if(!isset($this->country->iso_3166_2)) + return "Client has no country set!"; + $br = new \App\DataMapper\Tax\BaseRule(); $government_countries = array_merge($br->peppol_business_countries, $br->peppol_government_countries); diff --git a/tests/Integration/Einvoice/Storecove/EInvoiceValidationTest.php b/tests/Integration/Einvoice/Storecove/EInvoiceValidationTest.php index 4681acaba4..eef9a77299 100644 --- a/tests/Integration/Einvoice/Storecove/EInvoiceValidationTest.php +++ b/tests/Integration/Einvoice/Storecove/EInvoiceValidationTest.php @@ -363,7 +363,7 @@ class EInvoiceValidationTest extends TestCase 'company_id' => $company->id, 'classification' => 'individual', 'vat_number' => '', - 'country_id' => 1, + 'country_id' => 276, 'address1' => '10 Wallaby Way', 'address2' => '', 'city' => 'Sydney', @@ -383,6 +383,9 @@ class EInvoiceValidationTest extends TestCase $el = new EntityLevel(); $validation = $el->checkClient($client); + if(!$validation['passes']) + nlog($validation); + $this->assertTrue($validation['passes']); }