Files
fotospiel-app/tests/Feature/Api/Tenant/OnboardingStatusTest.php
2026-01-06 11:57:30 +01:00

77 lines
2.2 KiB
PHP

<?php
namespace Tests\Feature\Api\Tenant;
use Illuminate\Support\Arr;
use Tests\Feature\Tenant\TenantTestCase;
class OnboardingStatusTest extends TenantTestCase
{
public function test_tenant_can_dismiss_onboarding(): void
{
$response = $this->authenticatedRequest('POST', '/api/v1/tenant/onboarding', [
'step' => 'dismissed',
]);
$response->assertOk();
$this->tenant->refresh();
$dismissedAt = Arr::get($this->tenant->settings ?? [], 'onboarding.dismissed_at');
$this->assertNotNull($dismissedAt);
$show = $this->authenticatedRequest('GET', '/api/v1/tenant/onboarding');
$show->assertOk();
$show->assertJsonPath('steps.dismissed_at', $dismissedAt);
}
public function test_tenant_can_mark_onboarding_completed(): void
{
$response = $this->authenticatedRequest('POST', '/api/v1/tenant/onboarding', [
'step' => 'completed',
'meta' => [],
]);
$response->assertOk();
$this->tenant->refresh();
$completedAt = Arr::get($this->tenant->settings ?? [], 'onboarding.completed_at');
$this->assertNotNull($completedAt);
$show = $this->authenticatedRequest('GET', '/api/v1/tenant/onboarding');
$show->assertOk();
$show->assertJsonPath('steps.completed_at', $completedAt);
}
public function test_tenant_can_mark_summary_seen(): void
{
$response = $this->authenticatedRequest('POST', '/api/v1/tenant/onboarding', [
'step' => 'summary_seen',
'meta' => [
'package_id' => 123,
],
]);
$response->assertOk();
$this->tenant->refresh();
$seenPackageId = Arr::get($this->tenant->settings ?? [], 'onboarding.summary_seen_package_id');
$seenAt = Arr::get($this->tenant->settings ?? [], 'onboarding.summary_seen_at');
$this->assertSame(123, $seenPackageId);
$this->assertNotNull($seenAt);
$show = $this->authenticatedRequest('GET', '/api/v1/tenant/onboarding');
$show->assertOk();
$show->assertJsonPath('steps.summary_seen_package_id', 123);
$show->assertJsonPath('steps.summary_seen_at', $seenAt);
}
}