Converted all notification emails to the branded layout by routing them through a shared Blade template and swapping
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.
This commit is contained in:
71
tests/Feature/BrandedNotificationEmailsTest.php
Normal file
71
tests/Feature/BrandedNotificationEmailsTest.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\PackagePurchase;
|
||||
use App\Models\Tenant;
|
||||
use App\Notifications\Customer\RefundReceipt;
|
||||
use App\Notifications\InactiveTenantDeletionWarning;
|
||||
use App\Notifications\Ops\PurchaseCreated;
|
||||
use App\Notifications\UploadPipelineFailed;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BrandedNotificationEmailsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_upload_pipeline_failed_uses_branded_view(): void
|
||||
{
|
||||
$notification = new UploadPipelineFailed([
|
||||
'job' => 'UploadJob',
|
||||
'queue' => 'uploads',
|
||||
'event_id' => 123,
|
||||
'photo_id' => 456,
|
||||
'exception' => 'ExampleException',
|
||||
]);
|
||||
|
||||
$mailMessage = $notification->toMail((object) []);
|
||||
|
||||
$this->assertInstanceOf(MailMessage::class, $mailMessage);
|
||||
$this->assertSame('emails.notifications.basic', $mailMessage->view);
|
||||
$this->assertArrayHasKey('lines', $mailMessage->viewData);
|
||||
}
|
||||
|
||||
public function test_inactive_tenant_deletion_warning_uses_branded_view(): void
|
||||
{
|
||||
$tenant = Tenant::factory()->create([
|
||||
'name' => 'Demo Tenant',
|
||||
]);
|
||||
|
||||
$notification = new InactiveTenantDeletionWarning($tenant, Carbon::now()->addDays(10));
|
||||
$mailMessage = $notification->toMail((object) []);
|
||||
|
||||
$this->assertInstanceOf(MailMessage::class, $mailMessage);
|
||||
$this->assertSame('emails.notifications.basic', $mailMessage->view);
|
||||
$this->assertArrayHasKey('cta', $mailMessage->viewData);
|
||||
}
|
||||
|
||||
public function test_refund_receipt_uses_branded_view(): void
|
||||
{
|
||||
$purchase = PackagePurchase::factory()->create();
|
||||
$notification = new RefundReceipt($purchase);
|
||||
$mailMessage = $notification->toMail((object) []);
|
||||
|
||||
$this->assertInstanceOf(MailMessage::class, $mailMessage);
|
||||
$this->assertSame('emails.notifications.basic', $mailMessage->view);
|
||||
$this->assertArrayHasKey('footer', $mailMessage->viewData);
|
||||
}
|
||||
|
||||
public function test_ops_purchase_created_uses_branded_view(): void
|
||||
{
|
||||
$purchase = PackagePurchase::factory()->create();
|
||||
$notification = new PurchaseCreated($purchase);
|
||||
$mailMessage = $notification->toMail((object) []);
|
||||
|
||||
$this->assertInstanceOf(MailMessage::class, $mailMessage);
|
||||
$this->assertSame('emails.notifications.basic', $mailMessage->view);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user