Task 8 - customize validation messages

This commit is contained in:
PovilasKorop
2021-11-29 15:47:54 +02:00
parent ce6827fab8
commit 254985ac99
8 changed files with 130 additions and 3 deletions
+8 -3
View File
@@ -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');
}
}