style+fix(pd): pint formatting + nullsafe.neverNull fix + lifecycle test predicate

This commit is contained in:
Дмитрий
2026-05-22 16:45:12 +03:00
parent 8e732fa855
commit bc09186299
12 changed files with 77 additions and 56 deletions
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
use App\Models\ReportJob;
use App\Models\Tenant;
@@ -12,19 +14,19 @@ uses(DatabaseTransactions::class);
beforeEach(function () {
Storage::fake('local');
$this->tenant = Tenant::factory()->create();
$this->user = User::factory()->create(['tenant_id' => $this->tenant->id]);
$this->user = User::factory()->create(['tenant_id' => $this->tenant->id]);
$this->actingAs($this->user);
DB::statement('SET app.current_tenant_id = '.(int) $this->tenant->id);
});
it('writes pd deleted when a report file is destroyed', function () {
$job = ReportJob::create([
'tenant_id' => $this->tenant->id,
'user_id' => $this->user->id,
'type' => 'deals_export',
'tenant_id' => $this->tenant->id,
'user_id' => $this->user->id,
'type' => 'deals_export',
'parameters' => ['format' => 'csv', 'date_from' => '2026-04-01', 'date_to' => '2026-04-30'],
'status' => ReportJob::STATUS_DONE,
'file_path' => 'reports/'.(int) $this->tenant->id.'/test.csv',
'status' => ReportJob::STATUS_DONE,
'file_path' => 'reports/'.(int) $this->tenant->id.'/test.csv',
]);
$this->deleteJson("/api/reports/jobs/{$job->id}")->assertOk();
@@ -46,21 +48,21 @@ it('writes pd deleted (system actor) when cron cleanup-expired runs', function (
Storage::disk('local')->put('reports/'.(int) $this->tenant->id.'/cron2.csv', 'data');
ReportJob::create([
'tenant_id' => $this->tenant->id,
'user_id' => $this->user->id,
'type' => 'deals_export',
'tenant_id' => $this->tenant->id,
'user_id' => $this->user->id,
'type' => 'deals_export',
'parameters' => ['format' => 'csv'],
'status' => ReportJob::STATUS_DONE,
'file_path' => 'reports/'.(int) $this->tenant->id.'/cron1.csv',
'status' => ReportJob::STATUS_DONE,
'file_path' => 'reports/'.(int) $this->tenant->id.'/cron1.csv',
'expires_at' => now()->subDay(),
]);
ReportJob::create([
'tenant_id' => $this->tenant->id,
'user_id' => $this->user->id,
'type' => 'deals_export',
'tenant_id' => $this->tenant->id,
'user_id' => $this->user->id,
'type' => 'deals_export',
'parameters' => ['format' => 'csv'],
'status' => ReportJob::STATUS_DONE,
'file_path' => 'reports/'.(int) $this->tenant->id.'/cron2.csv',
'status' => ReportJob::STATUS_DONE,
'file_path' => 'reports/'.(int) $this->tenant->id.'/cron2.csv',
'expires_at' => now()->subDay(),
]);