fix tests isssues
API CI/CD / Validate (composer + pint) (push) Successful in 2m6s
API CI/CD / Test (PHPUnit) (push) Failing after 2m24s
API CI/CD / Build frontend assets (push) Successful in 2m25s
API CI/CD / Security audit (push) Successful in 32s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped

This commit is contained in:
root
2026-06-24 00:56:12 -04:00
parent 2e0bc37d91
commit baa6fff459
3 changed files with 28 additions and 18 deletions
+7 -8
View File
@@ -77,10 +77,9 @@ class AssignmentApiTest extends TestCase
'semester' => 'Fall',
'school_year' => '2025-2026',
'description' => 'Student assigned',
'is_active' => 1, // remove if your table doesnt have this column
]);
$response = $this->getJson('/api/assignments');
$response = $this->getJson('/api/v1/assignments');
$response->assertOk()
->assertJsonStructure([
@@ -137,7 +136,7 @@ class AssignmentApiTest extends TestCase
'school_year' => '2025-2026',
]);
$response = $this->getJson('/api/assignments?school_year=2025-2026');
$response = $this->getJson('/api/v1/assignments?school_year=2025-2026');
$response->assertOk();
@@ -165,7 +164,7 @@ class AssignmentApiTest extends TestCase
'description' => 'Moved after placement review',
];
$response = $this->postJson('/api/assignments', $payload);
$response = $this->postJson('/api/v1/assignments', $payload);
$response->assertCreated()
->assertJsonPath('message', 'Assignment saved successfully.');
@@ -183,7 +182,7 @@ class AssignmentApiTest extends TestCase
{
Sanctum::actingAs($this->user);
$response = $this->postJson('/api/assignments', []);
$response = $this->postJson('/api/v1/assignments', []);
$response->assertStatus(422)
->assertJsonValidationErrors([
@@ -202,7 +201,7 @@ class AssignmentApiTest extends TestCase
$sectionB = ClassSection::factory()->create();
// First create
$this->postJson('/api/assignments', [
$this->postJson('/api/v1/assignments', [
'student_id' => $student->id,
'class_section_id' => $sectionA->class_section_id,
'semester' => 'Fall',
@@ -210,7 +209,7 @@ class AssignmentApiTest extends TestCase
])->assertCreated();
// Second call same unique key should update (per service updateOrCreate)
$this->postJson('/api/assignments', [
$this->postJson('/api/v1/assignments', [
'student_id' => $student->id,
'class_section_id' => $sectionA->class_section_id,
'semester' => 'Fall',
@@ -238,7 +237,7 @@ class AssignmentApiTest extends TestCase
#[Test]
public function guest_cannot_access_assignment_api_when_auth_is_required(): void
{
$response = $this->getJson('/api/assignments');
$response = $this->getJson('/api/v1/assignments');
$response->assertStatus(401);
}