mirror of
https://github.com/10h30/Test-Laravel-Validation.git
synced 2026-06-05 15:07:56 +09:00
Task 6 - form request validation
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user