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

feat(tests): add tests for deleting legal mentions

- Added a test to ensure that deleting a nonexistent legal mention returns a 404 status.
- Added a test to verify that an active legal mention can be deleted successfully, and that it no longer exists in the database after deletion.
parent 09f04700
No related branches found
No related tags found
1 merge request!56Resolve "Ajouter mentions légales"
Pipeline #1007 passed
......@@ -87,4 +87,21 @@ public function test_it_can_delete_a_legal_mention()
$response->assertRedirect(route('admin.legal_mentions.index'));
$this->assertDatabaseMissing('legal_mentions', ['id' => $mention->id]);
}
public function test_it_cannot_delete_a_nonexistent_legal_mention()
{
$response = $this->get(route('admin.legal_mentions.delete', ['id' => 999]));
$response->assertStatus(404);
}
public function test_it_can_delete_an_active_legal_mention()
{
$mention = LegalMention::factory()->create(['active' => true]);
$response = $this->get(route('admin.legal_mentions.delete', ['id' => $mention->id]));
$response->assertRedirect(route('admin.legal_mentions.index'));
$this->assertDatabaseMissing('legal_mentions', ['id' => $mention->id]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment