From d47c6206edb0c5fd9af9a72be26605052ebcf9b3 Mon Sep 17 00:00:00 2001 From: misantron Date: Sat, 21 May 2016 20:48:01 +0300 Subject: [PATCH] Change contains validator default mode to strict --- src/Valitron/Validator.php | 2 +- tests/Valitron/ValidateTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Valitron/Validator.php b/src/Valitron/Validator.php index dbc7d09..4496e2d 100644 --- a/src/Valitron/Validator.php +++ b/src/Valitron/Validator.php @@ -427,7 +427,7 @@ class Validator return false; } - $strict = false; + $strict = true; if (isset($params[1])) { $strict = (bool) $params[1]; } diff --git a/tests/Valitron/ValidateTest.php b/tests/Valitron/ValidateTest.php index 5bbf54f..ac3ffca 100644 --- a/tests/Valitron/ValidateTest.php +++ b/tests/Valitron/ValidateTest.php @@ -703,14 +703,14 @@ class ValidateTest extends BaseTestCase public function testContainsValid() { $v = new Validator(array('test_string' => 'this is a Test')); - $v->rule('contains', 'test_string', 'a test'); + $v->rule('contains', 'test_string', 'Test'); $this->assertTrue($v->validate()); } - public function testContainsStrictValid() + public function testContainsNonStrictValid() { $v = new Validator(array('test_string' => 'this is a Test')); - $v->rule('contains', 'test_string', 'Test', true); + $v->rule('contains', 'test_string', 'test', false); $this->assertTrue($v->validate()); } @@ -724,7 +724,7 @@ class ValidateTest extends BaseTestCase public function testContainsStrictNotFound() { $v = new Validator(array('test_string' => 'this is a Test')); - $v->rule('contains', 'test_string', 'test', true); + $v->rule('contains', 'test_string', 'test'); $this->assertFalse($v->validate()); }