- 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
51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Mail\WorkspaceInvite;
|
|
use App\Models\Account;
|
|
use App\Models\Invite;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
test('workspace invite mail has correct subject', function () {
|
|
$account = Account::factory()->create(['name' => 'Test Account']);
|
|
$invite = Invite::factory()->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$mail = new WorkspaceInvite($invite);
|
|
|
|
expect($mail->envelope()->subject)->toBe("You've been invited to join Test Account");
|
|
});
|
|
|
|
test('workspace invite mail has correct content', function () {
|
|
$account = Account::factory()->create(['name' => 'My Team']);
|
|
$invite = Invite::factory()->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$mail = new WorkspaceInvite($invite);
|
|
$content = $mail->content();
|
|
|
|
expect($content->view)->toBe('mail.workspace-invite');
|
|
expect($content->with['title'])->toBe("You've been invited to join My Team");
|
|
expect($content->with['previewText'])->toBe("You've been invited to join My Team");
|
|
expect($content->with['invite'])->toBe($invite);
|
|
expect($content->with['url'])->toBe(route('app.invites.show', $invite->id));
|
|
});
|
|
|
|
test('workspace invite mail has no attachments', function () {
|
|
$invite = Invite::factory()->create();
|
|
|
|
$mail = new WorkspaceInvite($invite);
|
|
|
|
expect($mail->attachments())->toBeEmpty();
|
|
});
|
|
|
|
test('workspace invite mail is queueable', function () {
|
|
$invite = Invite::factory()->create();
|
|
|
|
$mail = new WorkspaceInvite($invite);
|
|
|
|
expect($mail)->toBeInstanceOf(ShouldQueue::class);
|
|
});
|