From 9f29a1b99a542ff8ad981f204cf577bdfb34be2e Mon Sep 17 00:00:00 2001 From: Tom Oude Rengerink Date: Mon, 26 Oct 2020 12:45:34 +0100 Subject: [PATCH] Added test for prepending field labels --- tests/Valitron/ErrorMessagesTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Valitron/ErrorMessagesTest.php b/tests/Valitron/ErrorMessagesTest.php index 583b1dd..ccae921 100644 --- a/tests/Valitron/ErrorMessagesTest.php +++ b/tests/Valitron/ErrorMessagesTest.php @@ -12,6 +12,19 @@ class ErrorMessagesTest extends BaseTestCase $this->assertSame(array("Name is required"), $v->errors('name')); } + /** + * Test the disabling of prepending the field labels + * to error messages. + */ + public function testErrorMessageExcludeFieldName() + { + $v = new Validator(array()); + $v->setPrependLabels(false); + $v->rule('required', 'name'); + $v->validate(); + $this->assertSame(array("is required"), $v->errors('name')); + } + public function testAccurateErrorMessageParams() { $v = new Validator(array('num' => 5));