Fixes for tests

This commit is contained in:
David Bomba 2023-05-15 21:49:38 +10:00
parent 25a7038a11
commit 44b0bcd019
2 changed files with 13 additions and 7 deletions

View File

@ -72,8 +72,10 @@ class ZipTax implements TaxProviderInterface
private function parseResponse($response)
{
$tax = $response['results']['0'];
if(isset($response['results']['0']))
return $response['results']['0'];
throw new \Exception("Error resolving tax (code) = " . $response['rCode']);
return $tax;
}
}

View File

@ -11,6 +11,7 @@
namespace Tests\Unit\Tax;
use App\DataProviders\USStates;
use Tests\TestCase;
use App\Models\Client;
use Tests\MockAccountData;
@ -56,15 +57,18 @@ class TaxConfigTest extends TestCase
'company_id' => $this->company->id,
'user_id' => $this->user->id,
'address1' => '400 Evelyn Pl',
'city' =>'Beverley Hills',
'state' =>'CA',
'postal_code' =>90210,
'city' => 'Beverley Hills',
'state' => '',
'postal_code' => 90210,
'country_id' => 840,
]);
$this->bootApi($client);
$this->tp->updateClientTaxData();
$this->assertEquals('CA', USStates::getState('90210'));
// $this->bootApi($client);
// $this->tp->updateClientTaxData();
}