add all controllers logic
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Staff;
|
||||
|
||||
use App\Models\Staff;
|
||||
use App\Models\User;
|
||||
use App\Services\Staff\StaffQueryService;
|
||||
use App\Services\System\GlobalConfigService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class StaffQueryServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_paginate_returns_staff(): void
|
||||
{
|
||||
$user = User::query()->create([
|
||||
'firstname' => 'Test',
|
||||
'lastname' => 'User',
|
||||
'email' => 'staffquery@example.com',
|
||||
'cellphone' => '5555555555',
|
||||
'address_street' => '123 Main',
|
||||
'city' => 'City',
|
||||
'state' => 'ST',
|
||||
'zip' => '12345',
|
||||
'accept_school_policy' => 1,
|
||||
'status' => 'Active',
|
||||
'password' => bcrypt('secret'),
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
Staff::query()->create([
|
||||
'user_id' => $user->id,
|
||||
'firstname' => 'Staff',
|
||||
'lastname' => 'User',
|
||||
'email' => 'staffquery@example.com',
|
||||
'role_name' => 'teacher',
|
||||
'active_role' => 'teacher',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new StaffQueryService(new GlobalConfigService());
|
||||
$result = $service->paginate([], 1, 10);
|
||||
|
||||
$this->assertSame(1, $result['paginator']->total());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user