Files
fotospiel-app/tests/Feature/BrandedNotificationEmailsTest.php
Codex Agent 207725d460 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.
2025-12-23 14:03:42 +01:00

72 lines
2.5 KiB
PHP

<?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);
}
}