Task 6 - form request validation

This commit is contained in:
PovilasKorop
2021-11-29 15:21:45 +02:00
parent b7eaace432
commit ccb91e35fb
6 changed files with 89 additions and 0 deletions
+14
View File
@@ -67,4 +67,18 @@ class ValidationTest extends TestCase
$response->assertStatus(200);
$response->assertSee('Abc');
}
public function test_form_request_validation()
{
// Post with no name/description should fail
$response = $this->post('items');
$response->assertStatus(302);
// Post with all the fields should succeed
$response = $this->post('items', [
'name' => 'Abc',
'description' => 'Xyz',
]);
$response->assertStatus(200);
}
}