- Create Account model as Cashier Billable entity (stripe, plan, subscription) - Account owns workspaces and has an owner_id (User) - User belongs to one Account via account_id - Workspace belongs to Account via account_id, no longer has billing fields - Remove Brand model entirely (workspaces serve as grouping) - Rename brand_limit to workspace_limit in plans - Workspace roles simplified: admin/member/viewer (owner via Account) - Invites now belong to Account with workspaces JSON array - Pennant features scope changed from Workspace to Account - EnsureSubscribed middleware checks Account subscription - All controllers updated: BillingController, OnboardingController, WorkspaceInviteController, SocialController, StripeEventListener - Frontend: extract GoogleAuthButton component, create WorkspaceRole enum for type-safe role checks, fix all views for new architecture - All 1101 tests passing
22 lines
539 B
PHP
22 lines
539 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Features\AiImagesLimit;
|
|
use App\Models\Account;
|
|
use App\Models\Plan;
|
|
|
|
test('returns plan ai images limit', function () {
|
|
$plan = new Plan(['ai_images_limit' => 200]);
|
|
$account = new Account;
|
|
$account->setRelation('plan', $plan);
|
|
|
|
expect((new AiImagesLimit)->resolve($account))->toBe(200);
|
|
});
|
|
|
|
test('falls back to 50 when no plan', function () {
|
|
$account = new Account;
|
|
$account->setRelation('plan', null);
|
|
|
|
expect((new AiImagesLimit)->resolve($account))->toBe(50);
|
|
});
|