Files
ladill-meet/tests/Feature/MeetEmailBrandingTest.php
T
isaaccladandCursor 5b7bb88767
Deploy Ladill Meet / deploy (push) Successful in 1m28s
Use organization logo in Meet outbound emails.
Replace the product email mark with company logo or name in contact-message mail.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 20:08:04 +00:00

101 lines
3.2 KiB
PHP

<?php
namespace Tests\Feature;
use App\Http\Middleware\EnsurePlatformSession;
use App\Mail\ContactMessageMail;
use App\Models\Invitation;
use App\Models\Member;
use App\Models\Organization;
use App\Models\Room;
use App\Models\User;
use App\Services\Meet\MeetNotificationService;
use App\Support\OrganizationBranding;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class MeetEmailBrandingTest extends TestCase
{
use RefreshDatabase;
protected User $user;
protected Organization $organization;
protected function setUp(): void
{
parent::setUp();
$this->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');
});
}
}