the MailMessage builders to use view(). This keeps the existing copy/labels but aligns the look with resources/views/ emails/partials/layout.blade.php. I also switched the customer add‑on receipt notification to reuse the existing branded view and added missing translations for the upload pipeline alert.
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\User;
|
|
use App\Notifications\VerifyEmailNotification;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Support\Facades\Notification;
|
|
use Tests\TestCase;
|
|
|
|
class VerifyEmailNotificationTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_user_sends_custom_verify_email_notification(): void
|
|
{
|
|
Notification::fake();
|
|
|
|
$user = User::factory()->create([
|
|
'email_verified_at' => null,
|
|
]);
|
|
|
|
$user->sendEmailVerificationNotification();
|
|
|
|
Notification::assertSentTo($user, VerifyEmailNotification::class);
|
|
}
|
|
|
|
public function test_verify_email_notification_uses_custom_view(): void
|
|
{
|
|
$user = User::factory()->create([
|
|
'email_verified_at' => null,
|
|
]);
|
|
|
|
$notification = new VerifyEmailNotification;
|
|
$mailMessage = $notification->toMail($user);
|
|
|
|
$this->assertInstanceOf(MailMessage::class, $mailMessage);
|
|
$this->assertSame('emails.verify-email', $mailMessage->view);
|
|
$this->assertArrayHasKey('verificationUrl', $mailMessage->viewData);
|
|
$this->assertArrayHasKey('user', $mailMessage->viewData);
|
|
$this->assertSame($user->getKey(), $mailMessage->viewData['user']->getKey());
|
|
}
|
|
}
|