verbesserung von benachrichtungen und warnungen an nutzer abgeschlossen. layout editor nun auf gutem stand.

This commit is contained in:
Codex Agent
2025-11-02 11:11:13 +01:00
parent 8e6c66f0db
commit 792b5dfe8b
32 changed files with 1292 additions and 149 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace Tests\Feature\Packages;
use App\Jobs\Packages\SendTenantCreditsLowNotification;
use App\Models\Tenant;
use App\Notifications\Packages\TenantCreditsLowNotification;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Notification;
use Tests\TestCase;
class SendTenantCreditsLowNotificationTest extends TestCase
{
use RefreshDatabase;
public function test_logs_successful_notification(): void
{
Notification::fake();
$tenant = Tenant::factory()->create([
'contact_email' => 'admin@example.com',
]);
$job = new SendTenantCreditsLowNotification($tenant->id, balance: 5, threshold: 10);
$job->handle();
Notification::assertSentOnDemand(TenantCreditsLowNotification::class, function ($notification, $channels, $notifiable) {
return in_array('mail', $channels, true) && ($notifiable->routes['mail'] ?? null) === 'admin@example.com';
});
$tenant->refresh();
$this->assertCount(1, $tenant->notificationLogs);
$log = $tenant->notificationLogs()->first();
$this->assertSame('credits_low', $log->type);
$this->assertSame('sent', $log->status);
$this->assertSame('admin@example.com', $log->recipient);
$this->assertNotNull($log->sent_at);
}
}