Files
fotospiel-app/tests/Feature/TenantLifecycleViewTest.php
Codex Agent da06db2d3b
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Add tenant lifecycle view and limit controls
2026-01-01 19:36:51 +01:00

46 lines
1.4 KiB
PHP

<?php
namespace Tests\Feature;
use App\Filament\Resources\TenantResource;
use App\Models\Tenant;
use App\Models\TenantNotificationLog;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class TenantLifecycleViewTest extends TestCase
{
use RefreshDatabase;
public function test_view_page_shows_lifecycle_timeline(): void
{
$user = User::factory()->create(['role' => 'super_admin']);
$tenant = Tenant::factory()->create([
'last_activity_at' => now()->subDay(),
'pending_deletion_at' => now()->addDays(10),
'deletion_warning_sent_at' => now()->subHours(2),
]);
TenantNotificationLog::query()->create([
'tenant_id' => $tenant->id,
'type' => 'retention_warning',
'channel' => 'mail',
'recipient' => 'owner@example.com',
'status' => 'sent',
'context' => ['source' => 'test'],
'sent_at' => now()->subHour(),
]);
$this->actingAs($user, 'super_admin');
$url = TenantResource::getUrl('lifecycle', ['record' => $tenant], panel: 'superadmin');
$this->get($url)
->assertOk()
->assertSee(__('admin.tenants.timeline.created'))
->assertSee(__('admin.tenants.timeline.deletion_scheduled'))
->assertSee(__('admin.tenants.timeline.notification_sent'));
}
}