mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fixes for tests
This commit is contained in:
parent
7a88d631dc
commit
25a7038a11
@ -114,7 +114,7 @@ class Rule extends BaseRule implements RuleInterface
|
||||
*/
|
||||
public function taxService($item): self
|
||||
{
|
||||
if($this->tax_data?->txbService == 'Y') {
|
||||
if(in_array($this->tax_data?->txbService,['Y','L'])) {
|
||||
$this->default($item);
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ class CompanyController extends BaseController
|
||||
$this->saveDocuments($request->input('documents'), $company, false);
|
||||
}
|
||||
|
||||
if($request->has('e_invoice_certificate')){
|
||||
if($request->has('e_invoice_certificate') && !is_null($request->file("e_invoice_certificate"))){
|
||||
|
||||
$company->e_invoice_certificate = base64_encode($request->file("e_invoice_certificate")->get());
|
||||
$company->save();
|
||||
|
@ -54,7 +54,7 @@ class UpdateCompanyRequest extends Request
|
||||
$rules['work_email'] = 'email|nullable';
|
||||
$rules['matomo_id'] = 'nullable|integer';
|
||||
$rules['e_invoice_certificate_passphrase'] = 'sometimes|nullable';
|
||||
$rules['e_invoice_certificate'] = 'sometimes|file|mimes:p12,pfx,pem,cer,crt,der,txt,p7b,spc,bin';
|
||||
$rules['e_invoice_certificate'] = 'sometimes|nullable|file|mimes:p12,pfx,pem,cer,crt,der,txt,p7b,spc,bin';
|
||||
// $rules['client_registration_fields'] = 'array';
|
||||
|
||||
if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) {
|
||||
|
@ -143,6 +143,8 @@ class CompanyTest extends TestCase
|
||||
|
||||
$company->settings = $settings;
|
||||
|
||||
nlog($company->toArray());
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
|
71
tests/Unit/Tax/TaxConfigTest.php
Normal file
71
tests/Unit/Tax/TaxConfigTest.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\Tax;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Client;
|
||||
use Tests\MockAccountData;
|
||||
use App\Services\Tax\Providers\TaxProvider;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* @test App\Services\Tax\Providers\EuTax
|
||||
*/
|
||||
class TaxConfigTest extends TestCase
|
||||
{
|
||||
use MockAccountData;
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
$this->makeTestData();
|
||||
|
||||
if(!config('services.tax.zip_tax.key'))
|
||||
$this->markTestSkipped('No API keys to test with.');
|
||||
}
|
||||
|
||||
public TaxProvider $tp;
|
||||
|
||||
private function bootApi(Client $client)
|
||||
{
|
||||
$this->tp = new TaxProvider($this->company, $client);
|
||||
}
|
||||
|
||||
public function testStateResolution()
|
||||
{
|
||||
//infer state from zip
|
||||
$client = Client::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
'address1' => '400 Evelyn Pl',
|
||||
'city' =>'Beverley Hills',
|
||||
'state' =>'CA',
|
||||
'postal_code' =>90210,
|
||||
'country_id' => 840,
|
||||
]);
|
||||
|
||||
$this->bootApi($client);
|
||||
|
||||
$this->tp->updateClientTaxData();
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user