2026-04-14 21:44:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
use App\Features\MemberLimit;
|
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 member limit', function () {
|
|
|
|
|
$plan = new Plan(['member_limit' => 10]);
|
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 MemberLimit)->resolve($account))->toBe(10);
|
2026-04-14 21:44:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('falls back to 1 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 MemberLimit)->resolve($account))->toBe(1);
|
2026-04-14 21:44:47 +00:00
|
|
|
});
|