partial fix for teacher class progress
API CI/CD / Validate (composer + pint) (push) Successful in 3m9s
API CI/CD / Test (PHPUnit) (push) Failing after 5m6s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m9s
API CI/CD / Test (PHPUnit) (push) Failing after 5m6s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -27,6 +27,76 @@ class ClassProgressControllerTest extends TestCase
|
||||
$this->assertNotEmpty($response->json('data.subject_sections'));
|
||||
}
|
||||
|
||||
public function test_legacy_teacher_submit_meta_uses_requested_year_and_legacy_curriculum_units(): void
|
||||
{
|
||||
$user = $this->createUser();
|
||||
DB::table('configuration')->updateOrInsert(
|
||||
['config_key' => 'school_year'],
|
||||
['config_value' => '2024-2025']
|
||||
);
|
||||
DB::table('configuration')->updateOrInsert(
|
||||
['config_key' => 'semester'],
|
||||
['config_value' => 'Spring']
|
||||
);
|
||||
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('classes')->insert([
|
||||
'id' => 9,
|
||||
'class_name' => 'Grade 9',
|
||||
'schedule' => 'Sunday',
|
||||
'capacity' => 25,
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
DB::table('classSection')->insert([
|
||||
'id' => 9,
|
||||
'class_id' => 9,
|
||||
'class_section_id' => 909,
|
||||
'class_section_name' => '9-A',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
DB::table('teacher_class')->insert([
|
||||
'class_section_id' => 909,
|
||||
'teacher_id' => $user->id,
|
||||
'position' => 'main',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
DB::table('subject_curriculum_items')->insert([
|
||||
'class_id' => 9,
|
||||
'school_year' => null,
|
||||
'subject' => 'islamic',
|
||||
'unit_number' => 1,
|
||||
'unit_title' => 'Faith',
|
||||
'chapter_name' => 'Intro',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$response = $this->getJson('/api/v1/teacher/class-progress-submit?school_year=2025-2026&semester=Fall&class_section_id=909');
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('status', true);
|
||||
$response->assertJsonPath('data.defaults.school_year', '2025-2026');
|
||||
$response->assertJsonPath('data.defaults.semester', 'Fall');
|
||||
$response->assertJsonPath('data.defaults.class_section_id', 909);
|
||||
$response->assertJsonPath('data.curriculum.islamic.0.chapter_name', 'Intro');
|
||||
$response->assertJsonPath('data.unit_options.islamic.0.label', 'Unit 1 - Faith');
|
||||
}
|
||||
|
||||
public function test_index_returns_paginated_reports(): void
|
||||
{
|
||||
$user = $this->createUser();
|
||||
|
||||
Reference in New Issue
Block a user