fix parent pages and teachers and admin
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -27,6 +27,112 @@ class PaymentManualControllerTest extends TestCase
|
||||
$this->assertSame(10, $response->json('parent.id'));
|
||||
}
|
||||
|
||||
public function test_search_returns_parent_data_by_selected_name(): void
|
||||
{
|
||||
$this->seedUsers();
|
||||
$this->seedConfig();
|
||||
$this->seedStudent();
|
||||
$this->seedInvoice();
|
||||
Sanctum::actingAs(User::query()->findOrFail(1));
|
||||
|
||||
$response = $this->getJson('/api/v1/finance/manual-pay/search?search_term=Parent+User&school_year=2025-2026');
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJson(['ok' => true]);
|
||||
$this->assertSame(10, $response->json('parent.id'));
|
||||
$this->assertNotEmpty($response->json('students'));
|
||||
$this->assertNotEmpty($response->json('invoices'));
|
||||
}
|
||||
|
||||
public function test_search_lists_multiple_parent_matches_alphabetically(): void
|
||||
{
|
||||
$this->seedUsers();
|
||||
$this->seedConfig();
|
||||
Sanctum::actingAs(User::query()->findOrFail(1));
|
||||
|
||||
DB::table('users')->insert([
|
||||
[
|
||||
'id' => 11,
|
||||
'school_id' => 1,
|
||||
'firstname' => 'Zara',
|
||||
'lastname' => 'Akter',
|
||||
'cellphone' => '5555555556',
|
||||
'email' => 'zara.akter@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' => 12,
|
||||
'school_id' => 1,
|
||||
'firstname' => 'Mousumi',
|
||||
'lastname' => 'Akter',
|
||||
'cellphone' => '5555555557',
|
||||
'email' => 'mousumi.akter@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' => 13,
|
||||
'school_id' => 1,
|
||||
'firstname' => 'Aisha',
|
||||
'lastname' => 'Akter',
|
||||
'cellphone' => '5555555558',
|
||||
'email' => 'aisha.akter@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' => 11, 'role_id' => 2],
|
||||
['user_id' => 12, 'role_id' => 2],
|
||||
['user_id' => 13, 'role_id' => 2],
|
||||
]);
|
||||
|
||||
$response = $this->getJson('/api/v1/finance/manual-pay/search?search_term=akter&school_year=2025-2026');
|
||||
|
||||
$response->assertOk();
|
||||
$this->assertSame([
|
||||
'Aisha Akter',
|
||||
'Mousumi Akter',
|
||||
'Zara Akter',
|
||||
], array_map(
|
||||
fn (array $parent) => $parent['firstname'].' '.$parent['lastname'],
|
||||
$response->json('parent_matches')
|
||||
));
|
||||
$this->assertSame(13, $response->json('parent.id'));
|
||||
}
|
||||
|
||||
public function test_suggest_returns_items(): void
|
||||
{
|
||||
$this->seedUsers();
|
||||
|
||||
Reference in New Issue
Block a user