Cleanup for Static Analysis

This commit is contained in:
David Bomba 2023-11-25 08:55:02 +11:00
parent 752054f86e
commit 77200d5bad
4 changed files with 29 additions and 8 deletions

View File

@ -92,6 +92,8 @@ class CreateAccount
$spaa9f78 = (new CreateUser($this->request, $sp794f3f, $sp035a66, true))->handle();
$sp035a66->service()->localizeCompany($spaa9f78);
(new CreateCompanyPaymentTerms($sp035a66, $spaa9f78))->handle();
(new CreateCompanyTaskStatuses($sp035a66, $spaa9f78))->handle();

View File

@ -104,7 +104,7 @@ class CreateCompany
if(request()->hasHeader('cf-ipcountry')) {
$c = Country::where('iso_3166_2', request()->header('cf-ipcountry'))->first();
$c = Country::query()->where('iso_3166_2', request()->header('cf-ipcountry'))->first();
if($c) {
return (string)$c->id;
@ -116,7 +116,7 @@ class CreateCompany
if($details && property_exists($details, 'countryCode')) {
$c = Country::where('iso_3166_2', $details->countryCode)->first();
$c = Country::query()->where('iso_3166_2', $details->countryCode)->first();
if($c) {
return (string)$c->id;

View File

@ -23,6 +23,7 @@ use Laracasts\Presenter\PresentableTrait;
use App\Utils\Traits\CompanySettingsSaver;
use Illuminate\Notifications\Notification;
use App\Models\Presenters\CompanyPresenter;
use App\Services\Company\CompanyService;
use App\Services\Notification\NotificationService;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -974,4 +975,9 @@ class Company extends BaseModel
return $this->e_invoice_certificate_passphrase;
}
public function service(): CompanyService
{
return new CompanyService($this);
}
}

View File

@ -11,18 +11,19 @@
namespace Tests\Feature;
use App\DataMapper\CompanySettings;
use App\Http\Middleware\PasswordProtection;
use Tests\TestCase;
use App\Models\Company;
use App\Models\TaxRate;
use Tests\MockAccountData;
use App\Models\CompanyToken;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Http\UploadedFile;
use App\DataMapper\CompanySettings;
use Illuminate\Support\Facades\Log;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Session;
use Tests\MockAccountData;
use Tests\TestCase;
use App\Http\Middleware\PasswordProtection;
use Illuminate\Foundation\Testing\DatabaseTransactions;
/**
* @test
@ -49,6 +50,18 @@ class CompanyTest extends TestCase
$this->makeTestData();
}
public function testCompanyTaxInit()
{
TaxRate::query()->delete();
$settings = $this->company->settings;
$settings->country_id = '40';
$this->company->saveSettings($settings, $this->company);
$this->company->service()->localizeCompany($this->user);
$this->assertEquals(1, TaxRate::count());
}
public function testCompanyLogoInline()
{