TenantAtlas/apps/platform/tests/Feature/Support/Diff/SharedDiffRowPartialTest.php
ahmido ce0615a9c1 Spec 182: relocate Laravel platform to apps/platform (#213)
## 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
2026-04-08 08:40:47 +00:00

140 lines
4.5 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Diff\DiffRow;
use App\Support\Diff\DiffRowStatus;
it('renders changed rows with shared state labels and from or to values', function (): void {
$this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'description',
label: 'Description',
status: DiffRowStatus::Changed,
oldValue: 'Before',
newValue: 'After',
),
'compact' => false,
'dimUnchanged' => true,
])
->assertSee('Changed')
->assertSee('Description')
->assertSee('Changed value')
->assertSee('From')
->assertSee('Before')
->assertSee('To')
->assertSee('After')
->assertSee('border-warning-200')
->assertSee('bg-warning-50/70');
});
it('renders added removed and unchanged rows through the shared dispatcher', function (): void {
$added = (string) $this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'new_setting',
label: 'New setting',
status: DiffRowStatus::Added,
newValue: 'Enabled',
),
'compact' => false,
'dimUnchanged' => true,
]);
$removed = (string) $this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'retired_setting',
label: 'Retired setting',
status: DiffRowStatus::Removed,
oldValue: 'Legacy',
),
'compact' => false,
'dimUnchanged' => true,
]);
$unchanged = (string) $this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'display_name',
label: 'Display name',
status: DiffRowStatus::Unchanged,
oldValue: 'TenantPilot',
newValue: 'TenantPilot',
),
'compact' => false,
'dimUnchanged' => true,
]);
expect($added)->toContain('Added')
->and($added)->toContain('Enabled')
->and($removed)->toContain('Removed')
->and($removed)->toContain('Legacy')
->and($unchanged)->toContain('Unchanged')
->and($unchanged)->toContain('TenantPilot');
});
it('delegates list-like rows to the inline list partial and dims unchanged content when requested', function (): void {
$listRow = (string) $this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'scope_tags',
label: 'Scope tags',
status: DiffRowStatus::Changed,
oldValue: ['Default', 'Legacy', 'Shared'],
newValue: ['Default', 'Shared', 'Workspace'],
isListLike: true,
addedItems: ['Workspace'],
removedItems: ['Legacy'],
unchangedItems: ['Default', 'Shared'],
),
'compact' => false,
'dimUnchanged' => true,
]);
$unchanged = (string) $this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'display_name',
label: 'Display name',
status: DiffRowStatus::Unchanged,
oldValue: 'TenantPilot',
newValue: 'TenantPilot',
),
'compact' => false,
'dimUnchanged' => true,
]);
expect($listRow)->toContain('Added items')
->and($listRow)->toContain('Removed items')
->and($listRow)->toContain('Unchanged items')
->and($unchanged)->toContain('text-gray-500')
->and($unchanged)->toContain('dark:text-gray-400');
});
it('keeps unchanged rows quieter than changed rows while preserving shared state badges', function (): void {
$changed = (string) $this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'description',
label: 'Description',
status: DiffRowStatus::Changed,
oldValue: 'Before',
newValue: 'After',
),
'compact' => false,
'dimUnchanged' => true,
]);
$unchanged = (string) $this->view('filament.partials.diff.row', [
'row' => new DiffRow(
key: 'display_name',
label: 'Display name',
status: DiffRowStatus::Unchanged,
oldValue: 'TenantPilot',
newValue: 'TenantPilot',
),
'compact' => false,
'dimUnchanged' => true,
]);
expect($changed)->toContain('border-warning-200')
->and($changed)->toContain('Changed value')
->and($unchanged)->toContain('No material change')
->and($unchanged)->toContain('rounded-xl border border-gray-200 bg-white');
});