## Summary - move the Laravel application into `apps/platform` and keep the repository root for orchestration, docs, and tooling - update the local command model, Sail/Docker wiring, runtime paths, and ignore rules around the new platform location - add relocation quickstart/contracts plus focused smoke coverage for bootstrap, command model, routes, and runtime behavior ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/PlatformRelocation` - integrated browser smoke validated `/up`, `/`, `/admin`, `/admin/choose-workspace`, and tenant route semantics for `200`, `403`, and `404` ## Remaining Rollout Checks - validate Dokploy build context and working-directory assumptions against the new `apps/platform` layout - confirm web, queue, and scheduler processes all start from the expected working directory in staging/production - verify no legacy volume mounts or asset-publish paths still point at the old root-level `public/` or `storage/` locations Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #213
82 lines
3.0 KiB
PHP
82 lines
3.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\FindingResource\Pages\ViewFinding;
|
|
use App\Models\Finding;
|
|
use App\Models\User;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('shows workflow header actions on the view page for authorized members', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
$this->actingAs($user);
|
|
Filament::setTenant($tenant, true);
|
|
|
|
$newFinding = Finding::factory()->for($tenant)->create(['status' => Finding::STATUS_NEW]);
|
|
$triagedFinding = Finding::factory()->for($tenant)->create(['status' => Finding::STATUS_TRIAGED]);
|
|
$resolvedFinding = Finding::factory()->for($tenant)->create([
|
|
'status' => Finding::STATUS_RESOLVED,
|
|
'resolved_at' => now(),
|
|
'resolved_reason' => 'fixed',
|
|
]);
|
|
|
|
Livewire::test(ViewFinding::class, ['record' => $newFinding->getKey()])
|
|
->assertActionVisible('triage')
|
|
->assertActionVisible('assign')
|
|
->assertActionVisible('resolve')
|
|
->assertActionVisible('close')
|
|
->assertActionVisible('request_exception');
|
|
|
|
Livewire::test(ViewFinding::class, ['record' => $triagedFinding->getKey()])
|
|
->assertActionVisible('start_progress');
|
|
|
|
Livewire::test(ViewFinding::class, ['record' => $resolvedFinding->getKey()])
|
|
->assertActionVisible('reopen');
|
|
});
|
|
|
|
it('executes workflow actions from view header and supports assignment to tenant members only', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
$this->actingAs($user);
|
|
Filament::setTenant($tenant, true);
|
|
|
|
$assignee = User::factory()->create();
|
|
createUserWithTenant(tenant: $tenant, user: $assignee, role: 'operator');
|
|
|
|
$outsider = User::factory()->create();
|
|
|
|
$finding = Finding::factory()->for($tenant)->create(['status' => Finding::STATUS_NEW]);
|
|
|
|
Livewire::test(ViewFinding::class, ['record' => $finding->getKey()])
|
|
->callAction('triage')
|
|
->assertHasNoActionErrors()
|
|
->callAction('assign', [
|
|
'assignee_user_id' => (int) $assignee->getKey(),
|
|
'owner_user_id' => (int) $user->getKey(),
|
|
])
|
|
->assertHasNoActionErrors()
|
|
->callAction('resolve', [
|
|
'resolved_reason' => 'handled in queue',
|
|
])
|
|
->assertHasNoActionErrors();
|
|
|
|
$finding->refresh();
|
|
expect($finding->status)->toBe(Finding::STATUS_RESOLVED)
|
|
->and((int) $finding->assignee_user_id)->toBe((int) $assignee->getKey())
|
|
->and((int) $finding->owner_user_id)->toBe((int) $user->getKey());
|
|
|
|
Livewire::test(ViewFinding::class, ['record' => $finding->getKey()])
|
|
->callAction('reopen')
|
|
->assertHasNoActionErrors()
|
|
->callAction('assign', [
|
|
'assignee_user_id' => (int) $outsider->getKey(),
|
|
'owner_user_id' => (int) $user->getKey(),
|
|
]);
|
|
|
|
$finding->refresh();
|
|
expect((int) $finding->assignee_user_id)->toBe((int) $assignee->getKey());
|
|
});
|