add controllers, servoices
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Expenses;
|
||||
|
||||
use App\Services\Expenses\ExpenseStaffService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ExpenseStaffServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_list_staff_users_excludes_parents(): void
|
||||
{
|
||||
DB::table('roles')->insert([
|
||||
['id' => 1, 'name' => 'administrator', 'slug' => 'administrator', 'is_active' => 1],
|
||||
['id' => 2, 'name' => 'parent', 'slug' => 'parent', 'is_active' => 1],
|
||||
]);
|
||||
|
||||
DB::table('users')->insert([
|
||||
[
|
||||
'id' => 10,
|
||||
'school_id' => 1,
|
||||
'firstname' => 'Staff',
|
||||
'lastname' => 'User',
|
||||
'cellphone' => '5555555555',
|
||||
'email' => 'staff@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',
|
||||
],
|
||||
[
|
||||
'id' => 11,
|
||||
'school_id' => 1,
|
||||
'firstname' => 'Parent',
|
||||
'lastname' => 'User',
|
||||
'cellphone' => '5555555555',
|
||||
'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],
|
||||
['user_id' => 11, 'role_id' => 2],
|
||||
]);
|
||||
|
||||
$service = new ExpenseStaffService();
|
||||
$staff = $service->listStaffUsers();
|
||||
|
||||
$this->assertCount(1, $staff);
|
||||
$this->assertSame(10, $staff[0]['id']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user