Update tenant lifecycle tooling and retire docs/process
This commit is contained in:
45
tests/Feature/TenantLifecycleViewTest.php
Normal file
45
tests/Feature/TenantLifecycleViewTest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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('view', ['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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user