Aplicar Pint aos 18 ficheiros que falhavam lint:check

Só formatação. 16 já falhavam em fase5-producao; 2 vêm de c9bd6db.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 17:40:37 +02:00
co-authored by Claude Opus 5.5
parent 95f80a10d7
commit f590a29e55
18 changed files with 50 additions and 47 deletions
+1 -1
View File
@@ -154,6 +154,6 @@ final class CommonReceiptStockTest extends TestCase
file_put_contents($root.'/receipt-results.json', json_encode(['identity' => $i, 'physical_accepted_milli' => 4000, 'rejected_milli' => 2000, 'movement_count_main' => 1,
'source_version_stale_refused' => true, 'core_replay_same_movement' => true, 'fault_atomic_and_recovered' => true, 'concurrency' => ['actual_lock_wait' => true, 'wait_event' => $wait->wait_event, 'same_receipt' => true, 'one_movement' => true],
'link' => ['tenant' => (int) $f['tenant']->id, 'warehouse' => (int) $f['warehouse']->id, 'item' => (int) $f['stock']->id, 'movement' => (int) $movement->id, 'reference' => $movement->snapshot['reference']],
'writer_manifest_sha256' => hash_file('sha256',base_path('packages/inventory-write/releases/0.1.0/manifest.json'))], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
'writer_manifest_sha256' => hash_file('sha256', base_path('packages/inventory-write/releases/0.1.0/manifest.json'))], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
}
}
+8 -5
View File
@@ -13,10 +13,13 @@ use App\Models\Supplier;
use App\Models\Tenant;
use App\Models\User;
use App\Services\ConflictGuard;
use App\Services\ConflictReleases;
use App\Services\RequisitionWorkflow;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Inertia\Testing\AssertableInertia as Assert;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Tempo\Purchasing\Composition\ExecutionContext;
function personalConflict(int $supplierId, ?int $requisitionId = null, bool $hasConflict = true): array
{
@@ -385,10 +388,10 @@ test('guests cannot consult or submit declarations', function () {
test('composed conflict authority is scoped and never inferred from the environment', function () {
require_once dirname(__DIR__, 2).'/packages/purchasing/src/ExecutionContext.php';
$execution = new \Tempo\Purchasing\Composition\ExecutionContext;
app()->instance(\Tempo\Purchasing\Composition\ExecutionContext::class, $execution);
$execution = new ExecutionContext;
app()->instance(ExecutionContext::class, $execution);
config(['conflict-releases.qa_enabled' => true]);
$service = app(\App\Services\ConflictReleases::class);
$service = app(ConflictReleases::class);
expect($service->ready())->toBeFalse();
$this->post('/conflitos', personalConflict($this->supplier->id, $this->r->id))->assertSessionHasNoErrors();
$declaration = ConflictDeclaration::query()->firstOrFail();
@@ -409,11 +412,11 @@ test('composed conflict authority is scoped and never inferred from the environm
expect($service->authorise($this->admin, $declaration, $input)->id)->toBe($first->id)
->and(ConflictRelease::query()->count())->toBe(1);
DB::table('organization_memberships')->where('user_id', $this->admin->id)->delete();
expect(fn () => $service->authorise($this->admin, $declaration, $input))->toThrow(\Symfony\Component\HttpKernel\Exception\HttpException::class);
expect(fn () => $service->authorise($this->admin, $declaration, $input))->toThrow(HttpException::class);
});
expect($service->ready())->toBeFalse()->and($declaration->fresh()->getAttributes())->toBe($before);
} finally {
app()->instance('env', 'testing');
app()->forgetInstance(\Tempo\Purchasing\Composition\ExecutionContext::class);
app()->forgetInstance(ExecutionContext::class);
}
});
+4 -4
View File
@@ -273,11 +273,11 @@ final class NativePayablePageTest extends TestCase
$pipes = [];
$environment = getenv();
$environment['COMMON_PAYABLES_PATH'] = base_path('packages/payables');
$p = proc_open([PHP_BINARY, base_path('tests/Support/native-payable-page-worker.php'), $input],[0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']],$pipes,base_path(),$environment);
$p = proc_open([PHP_BINARY, base_path('tests/Support/native-payable-page-worker.php'), $input], [0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']], $pipes, base_path(), $environment);
$this->assertIsResource($p);
fclose($pipes[0]);
$this->assertSame(0,proc_close($p));
$r = json_decode(file_get_contents($input.'.result'),true);
$this->assertSame(503,$r['status']);
$this->assertSame(0, proc_close($p));
$r = json_decode(file_get_contents($input.'.result'), true);
$this->assertSame(503, $r['status']);
}
}
@@ -562,16 +562,16 @@ final class WarehouseReturnIntegrationTest extends TestCase
});
$first = $this->getJson('/api/stock-returns')->assertOk()->assertJsonPath('pagination.total', 51)->assertJsonPath('pagination.last_page', 3)->assertJsonCount(25, 'rows')->json('rows');
$capture = false;
$this->assertLessThanOrEqual(4,count($queries));
$second = $this->getJson('/api/stock-returns?page=2')->assertOk()->assertJsonCount(25,'rows')->json('rows');
$this->assertEmpty(array_intersect(array_column($first,'id'),array_column($second,'id')));
$this->assertGreaterThan($second[0]['id'],$first[24]['id']);
$this->getJson('/api/stock-returns?page=3')->assertOk()->assertJsonCount(1,'rows');
$this->assertLessThanOrEqual(4, count($queries));
$second = $this->getJson('/api/stock-returns?page=2')->assertOk()->assertJsonCount(25, 'rows')->json('rows');
$this->assertEmpty(array_intersect(array_column($first, 'id'), array_column($second, 'id')));
$this->assertGreaterThan($second[0]['id'], $first[24]['id']);
$this->getJson('/api/stock-returns?page=3')->assertOk()->assertJsonCount(1, 'rows');
$this->actingAs($this->f['receiver']);
$this->confirm($p)->assertOk();
$this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total',50);
$this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total',1);
$this->assertSame(8000,$this->balance());
file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/return-history-metrics.json',json_encode(['fixture_records' => 51, 'page_size' => 25, 'supply_record_selects_for_page' => count($queries), 'pages_disjoint' => true, 'state_filters_cover_latest_versions' => true, 'not_a_load_capacity_benchmark' => true],JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
$this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total', 50);
$this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total', 1);
$this->assertSame(8000, $this->balance());
file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/return-history-metrics.json', json_encode(['fixture_records' => 51, 'page_size' => 25, 'supply_record_selects_for_page' => count($queries), 'pages_disjoint' => true, 'state_filters_cover_latest_versions' => true, 'not_a_load_capacity_benchmark' => true], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
}
}
@@ -385,13 +385,13 @@ final class SgfInvoiceDispatchesTest extends TestCase
file_put_contents($this->privateRoot.'/screen-preview.html', $html);
$this->post('/facturas/envio-sgf/1/operar', ['version' => 3, 'action' => 'confirm', 'reason' => 'Confirmar apenas este impacto mostrado.', 'approval_hash' => $match[1]])->assertRedirect('/facturas/envio-sgf/1');
$done = $this->get('/facturas/envio-sgf/1')->assertOk()->assertSee('Recibo conservado')->assertDontSee('Confirmar individualmente')->assertSee('http://127.0.0.1:8085/compras?', false)->getContent();
file_put_contents($this->privateRoot.'/screen-receipt.html',$done);
self::assertCount(1,$this->remote);
file_put_contents($this->privateRoot.'/screen-receipt.html', $done);
self::assertCount(1, $this->remote);
}
public function test_missing_schema_is_refused_without_activating_or_migrating(): void
{
$migration = require dirname(__DIR__,2).'/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php';
$migration = require dirname(__DIR__, 2).'/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php';
$migration->down();
$this->get('/facturas/envio-sgf')->assertStatus(503);
Http::assertNothingSent();
@@ -402,8 +402,8 @@ final class SgfInvoiceDispatchesTest extends TestCase
{
$row = $this->prepared();
$event = DB::table('sgf_invoice_dispatch_events')->orderByDesc('id')->first();
$state = json_decode($event->after_state,true);
self::assertSame(1,$state['preview_actor_id']);
self::assertSame($row->source_context_hash,$state['source_context_hash']);
$state = json_decode($event->after_state, true);
self::assertSame(1, $state['preview_actor_id']);
self::assertSame($row->source_context_hash, $state['source_context_hash']);
}
}
+1 -1
View File
@@ -38,4 +38,4 @@ try {
$result = ['status' => $e->getStatusCode()];
}
$result['elapsed_ms'] = round((hrtime(true) - $start) / 1e6, 3);
file_put_contents($file.'.result', json_encode($result,JSON_THROW_ON_ERROR));
file_put_contents($file.'.result', json_encode($result, JSON_THROW_ON_ERROR));
+1 -1
View File
@@ -65,4 +65,4 @@ foreach (['equipment', 'part'] as $unsupported) {
}
$data = json_decode(DB::table('ir_requests')->where('id', $id)->value('data'), true, 32, JSON_THROW_ON_ERROR);
$check(array_column($data['items'], 'purchase_type') === ['consumable', 'service', 'other'], 'approved lifecycle covers the three supported basic types');
$check(DB::table('ir_requests')->count() === 1 && DB::table('cb_budget_entries')->where('kind','reserve')->count() === 1, 'unsupported types create neither a second request nor reservation');
$check(DB::table('ir_requests')->count() === 1 && DB::table('cb_budget_entries')->where('kind', 'reserve')->count() === 1, 'unsupported types create neither a second request nor reservation');
+1 -1
View File
@@ -126,6 +126,6 @@ try {
throw new RuntimeException('Use setup/verify');
}
} catch (Throwable $e) {
fwrite(STDERR,get_class($e).': '.$e->getMessage()."\n");
fwrite(STDERR, get_class($e).': '.$e->getMessage()."\n");
exit(1);
}
+1 -1
View File
@@ -46,4 +46,4 @@ try {
} catch (HttpExceptionInterface $e) {
$out = ['status' => $e->getStatusCode()];
}
file_put_contents($file.'.result',json_encode($out,JSON_THROW_ON_ERROR));
file_put_contents($file.'.result', json_encode($out, JSON_THROW_ON_ERROR));