Skip to content
Snippets Groups Projects
Verified Commit 6c991ca3 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

feat(tests): add tests for terms section deletion functionality

- Added test for successful deletion of an active terms section.
- Added test for handling deletion of a nonexistent terms section, asserting a 404 status.
- Ensured database reflects the deletion correctly after the operation.
parent 74b7bd35
Branches
No related tags found
1 merge request!56Resolve "Ajouter mentions légales"
Pipeline #1008 passed
......@@ -66,4 +66,21 @@ public function test_it_can_delete_a_terms_section()
$response->assertRedirect(route('admin.terms.index'));
$this->assertDatabaseMissing('terms_sections', ['id' => $section->id]);
}
public function test_it_cannot_delete_a_nonexistent_terms_section()
{
$response = $this->get(route('admin.terms.delete', 999));
$response->assertStatus(404);
}
public function test_it_can_delete_an_active_terms_section()
{
$section = TermsSection::factory()->create(['active' => true]);
$response = $this->get(route('admin.terms.delete', $section->id));
$response->assertRedirect(route('admin.terms.index'));
$this->assertDatabaseMissing('terms_sections', ['id' => $section->id]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment