add controllers, servoices
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?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' => 'user',
|
||||
'status' => 'sent',
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('user_notifications', [
|
||||
'user_id' => 10,
|
||||
'delivered' => 1,
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user