withoutMiddleware(EnsurePlatformSession::class); $this->user = User::create([ 'public_id' => 'meet-brand-001', 'name' => 'Test User', 'email' => 'meet@example.com', ]); $this->organization = Organization::create([ 'owner_ref' => $this->user->public_id, 'name' => 'Meet Corp', 'slug' => 'meet-corp', 'timezone' => 'UTC', 'settings' => ['onboarded' => true], ]); Member::create([ 'owner_ref' => $this->user->public_id, 'organization_id' => $this->organization->id, 'user_ref' => $this->user->public_id, 'role' => 'owner', ]); } public function test_invitation_email_contains_organization_branding(): void { Storage::fake('public'); Mail::fake(); $path = UploadedFile::fake()->image('meet-logo.png', 400, 120) ->store('meet/organizations/'.$this->organization->id, 'public'); $this->organization->update(['logo_path' => $path, 'name' => 'Meet Corp']); $room = Room::create([ 'owner_ref' => $this->user->public_id, 'organization_id' => $this->organization->id, 'host_user_ref' => $this->user->public_id, 'title' => 'Quarterly Review', 'type' => 'scheduled', 'status' => 'scheduled', 'scheduled_at' => now()->addDay(), 'timezone' => 'UTC', 'settings' => config('meet.default_settings'), ]); $invitation = Invitation::create([ 'owner_ref' => $this->user->public_id, 'room_id' => $room->id, 'email' => 'guest@example.com', 'role' => 'participant', 'status' => 'pending', 'sent_at' => now(), ]); app(MeetNotificationService::class)->sendInvitationEmail($room, $invitation, $this->user); $logoUrl = OrganizationBranding::emailLogoUrl($this->organization->fresh()); Mail::assertSent(ContactMessageMail::class, function (ContactMessageMail $mail) use ($logoUrl) { $html = $mail->render(); return $mail->companyName === 'Meet Corp' && $mail->logoUrl === $logoUrl && str_contains($html, 'Meet Corp') && str_contains($html, $logoUrl) && ! str_contains($html, 'ladillmeet-logo-email') && ! str_contains($html, 'Sent via Ladill Meet'); }); } }