Files
alrahma_sunday_school_api/tests/Unit/Services/Payments/PaymentNotificationDispatchServiceTest.php
T
2026-06-09 00:03:03 -04:00

41 lines
1.2 KiB
PHP

<?php
namespace Tests\Unit\Services\Payments;
use App\Services\Payments\PaymentNotificationDispatchService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class PaymentNotificationDispatchServiceTest extends TestCase
{
use RefreshDatabase;
public function test_notify_user_creates_notification_records(): void
{
DB::table('configuration')->insert([
['id' => 2001, 'config_key' => 'school_year', 'config_value' => '2025-2026'],
['id' => 2002, 'config_key' => 'semester', 'config_value' => 'Fall'],
]);
$service = new PaymentNotificationDispatchService;
$service->notifyUser(10, 'Payment Reminder', 'Reminder body', ['in_app']);
$this->assertDatabaseHas('notifications', [
'title' => 'Payment Reminder',
'message' => 'Reminder body',
'target_group' => 'everyone',
'status' => 'sent',
'school_year' => '2025-2026',
'semester' => 'Fall',
]);
$this->assertDatabaseHas('user_notifications', [
'user_id' => 10,
'delivered' => 1,
'school_year' => '2025-2026',
'semester' => 'Fall',
]);
}
}