mirror of
https://github.com/10h30/Test-Laravel-Validation.git
synced 2026-06-05 15:07:56 +09:00
Task 8 - customize validation messages
This commit is contained in:
@@ -45,7 +45,6 @@ class ValidationTest extends TestCase
|
||||
|
||||
public function test_validation_errors_shown_in_blade()
|
||||
{
|
||||
// Post without name and description should fail
|
||||
$response = $this->followingRedirects()->post('projects');
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('The name field is required.');
|
||||
@@ -54,7 +53,6 @@ class ValidationTest extends TestCase
|
||||
|
||||
public function test_validation_specific_error_shown_in_blade()
|
||||
{
|
||||
// Post without name should fail
|
||||
$response = $this->followingRedirects()->post('products');
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('The name field is required.');
|
||||
@@ -62,7 +60,6 @@ class ValidationTest extends TestCase
|
||||
|
||||
public function test_old_value_stays_in_form_after_validation_error()
|
||||
{
|
||||
// Post without name should fail
|
||||
$response = $this->followingRedirects()->post('teams', ['name' => 'Abc']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('Abc');
|
||||
@@ -99,4 +96,12 @@ class ValidationTest extends TestCase
|
||||
$this->assertNotNull($user);
|
||||
$this->assertEquals(false, $user->is_admin);
|
||||
}
|
||||
|
||||
public function test_custom_error_message()
|
||||
{
|
||||
$response = $this->followingRedirects()->post('buildings');
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('Please enter the name');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user