2026-04-14 21:44:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-04-15 01:22:04 +00:00
|
|
|
use App\Features\WorkspaceLimit;
|
|
|
|
|
use App\Models\Account;
|
2026-04-14 21:44:47 +00:00
|
|
|
use App\Models\Plan;
|
|
|
|
|
|
2026-04-15 01:22:04 +00:00
|
|
|
test('returns plan workspace limit', function () {
|
|
|
|
|
$plan = new Plan(['workspace_limit' => 5]);
|
|
|
|
|
$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 WorkspaceLimit)->resolve($account))->toBe(5);
|
2026-04-14 21:44:47 +00:00
|
|
|
});
|
|
|
|
|
|
2026-04-15 01:22:04 +00:00
|
|
|
test('falls back to 1 when no plan', function () {
|
|
|
|
|
$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 WorkspaceLimit)->resolve($account))->toBe(1);
|
2026-04-14 21:44:47 +00:00
|
|
|
});
|