fix apply the plan docs/alrahma_api_fix_plan_school_year_only_v7
API CI/CD / Validate (composer + pint) (push) Successful in 3m10s
API CI/CD / Test (PHPUnit) (push) Failing after 6m49s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 1m0s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m10s
API CI/CD / Test (PHPUnit) (push) Failing after 6m49s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 1m0s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -45,7 +45,7 @@ class ClassProgressControllerTest extends TestCase
|
||||
$this->assertCount(2, $response->json('data.items'));
|
||||
}
|
||||
|
||||
public function test_admin_grouped_index_accepts_school_year_id_and_includes_legacy_rows(): void
|
||||
public function test_admin_grouped_index_uses_school_year_name_and_includes_legacy_rows(): void
|
||||
{
|
||||
$admin = $this->createUser('admin@example.com');
|
||||
$this->assignRole($admin->id, 'administrator');
|
||||
@@ -54,8 +54,9 @@ class ClassProgressControllerTest extends TestCase
|
||||
'semester' => '',
|
||||
'school_year' => null,
|
||||
]);
|
||||
$schoolYearId = DB::table('school_years')->insertGetId([
|
||||
DB::table('school_years')->updateOrInsert([
|
||||
'name' => '2025-2026',
|
||||
], [
|
||||
'start_date' => '2025-08-01',
|
||||
'end_date' => '2026-07-31',
|
||||
'status' => 'active',
|
||||
@@ -74,21 +75,30 @@ class ClassProgressControllerTest extends TestCase
|
||||
|
||||
Sanctum::actingAs($admin);
|
||||
|
||||
$response = $this->getJson('/api/v1/class-progress?school_year_id='.$schoolYearId.'&group_by_week=1');
|
||||
$response = $this->getJson('/api/v1/class-progress?school_year=2025-2026&group_by_week=1');
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('status', true);
|
||||
$this->assertCount(1, $response->json('data.items'));
|
||||
|
||||
$administratorAlias = $this->getJson('/api/v1/administrator/progress?school_year_id='.$schoolYearId.'&group_by_week=1');
|
||||
$administratorAlias = $this->getJson('/api/v1/administrator/progress?school_year=2025-2026&group_by_week=1');
|
||||
$administratorAlias->assertOk();
|
||||
$this->assertCount(1, $administratorAlias->json('data.items'));
|
||||
|
||||
$adminAlias = $this->getJson('/api/v1/admin/progress?school_year_id='.$schoolYearId.'&group_by_week=1');
|
||||
$adminAlias = $this->getJson('/api/v1/admin/progress?school_year=2025-2026&group_by_week=1');
|
||||
$adminAlias->assertOk();
|
||||
$this->assertCount(1, $adminAlias->json('data.items'));
|
||||
}
|
||||
|
||||
public function test_index_rejects_school_year_id_context(): void
|
||||
{
|
||||
$user = $this->createUser();
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->getJson('/api/v1/class-progress?school_year_id=1')
|
||||
->assertStatus(422);
|
||||
}
|
||||
|
||||
public function test_parent_progress_returns_reports_for_enrolled_sections(): void
|
||||
{
|
||||
$parent = $this->createUser('parent@example.com');
|
||||
@@ -196,6 +206,7 @@ class ClassProgressControllerTest extends TestCase
|
||||
'unit_islamic' => ['Unit 1'],
|
||||
'chapter_islamic' => ['Chapter A'],
|
||||
'flags' => ['needs_support'],
|
||||
'school_year' => '2025-2026',
|
||||
];
|
||||
|
||||
$response = $this->postJson('/api/v1/class-progress', $payload);
|
||||
@@ -246,6 +257,7 @@ class ClassProgressControllerTest extends TestCase
|
||||
|
||||
$response = $this->patchJson('/api/v1/class-progress/'.$report->id, [
|
||||
'status' => 'behind',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
@@ -266,7 +278,7 @@ class ClassProgressControllerTest extends TestCase
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$response = $this->deleteJson('/api/v1/class-progress/'.$report->id);
|
||||
$response = $this->deleteJson('/api/v1/class-progress/'.$report->id.'?school_year=2025-2026');
|
||||
|
||||
$response->assertOk();
|
||||
$this->assertDatabaseMissing('class_progress_reports', [
|
||||
@@ -328,6 +340,17 @@ class ClassProgressControllerTest extends TestCase
|
||||
|
||||
private function seedClassSection(): void
|
||||
{
|
||||
DB::table('school_years')->updateOrInsert([
|
||||
'name' => '2025-2026',
|
||||
], [
|
||||
'start_date' => '2025-08-01',
|
||||
'end_date' => '2026-07-31',
|
||||
'status' => 'active',
|
||||
'is_current' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
DB::table('classSection')->insert([
|
||||
'id' => 1,
|
||||
'class_id' => 1,
|
||||
|
||||
Reference in New Issue
Block a user