add notifications logic and add support of both JWT and Sanctum

This commit is contained in:
root
2026-03-11 01:20:31 -04:00
parent f6be51576c
commit 182036cc41
141 changed files with 8685 additions and 648 deletions
@@ -0,0 +1,55 @@
<?php
namespace Tests\Unit\Services\Notifications;
use App\Services\Notifications\NotificationRecipientService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class NotificationRecipientServiceTest extends TestCase
{
use RefreshDatabase;
public function test_get_recipients_by_role(): void
{
DB::table('roles')->insert([
'id' => 1,
'name' => 'parent',
'slug' => 'parent',
'is_active' => 1,
]);
DB::table('users')->insert([
'id' => 10,
'school_id' => 1,
'firstname' => 'Parent',
'lastname' => 'User',
'cellphone' => '5551112222',
'email' => 'parent@example.com',
'address_street' => '123 Main',
'city' => 'City',
'state' => 'ST',
'zip' => '12345',
'accept_school_policy' => 1,
'is_verified' => 1,
'status' => 'Active',
'is_suspended' => 0,
'failed_attempts' => 0,
'password' => bcrypt('secret'),
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
DB::table('user_roles')->insert([
'user_id' => 10,
'role_id' => 1,
]);
$service = new NotificationRecipientService();
$rows = $service->getRecipients('parent');
$this->assertCount(1, $rows);
$this->assertSame('parent@example.com', $rows[0]['email']);
}
}