2026-04-14 21:44:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
use App\Features\DataRetentionDays;
|
2026-04-15 01:22:04 +00:00
|
|
|
use App\Models\Account;
|
2026-04-14 21:44:47 +00:00
|
|
|
use App\Models\Plan;
|
|
|
|
|
|
|
|
|
|
test('returns plan data retention days', function () {
|
|
|
|
|
$plan = new Plan(['data_retention_days' => 365]);
|
2026-04-15 01:22:04 +00:00
|
|
|
$account = new Account;
|
|
|
|
|
$account->setRelation('plan', $plan);
|
2026-04-14 21:44:47 +00:00
|
|
|
|
2026-04-15 01:22:04 +00:00
|
|
|
expect((new DataRetentionDays)->resolve($account))->toBe(365);
|
2026-04-14 21:44:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('falls back to 30 when no plan', function () {
|
2026-04-15 01:22:04 +00:00
|
|
|
$account = new Account;
|
|
|
|
|
$account->setRelation('plan', null);
|
2026-04-14 21:44:47 +00:00
|
|
|
|
2026-04-15 01:22:04 +00:00
|
|
|
expect((new DataRetentionDays)->resolve($account))->toBe(30);
|
2026-04-14 21:44:47 +00:00
|
|
|
});
|