Change contains validator default mode to strict

This commit is contained in:
misantron 2016-05-21 20:48:01 +03:00
parent a89c0972c1
commit d47c6206ed
2 changed files with 5 additions and 5 deletions

View File

@ -427,7 +427,7 @@ class Validator
return false; return false;
} }
$strict = false; $strict = true;
if (isset($params[1])) { if (isset($params[1])) {
$strict = (bool) $params[1]; $strict = (bool) $params[1];
} }

View File

@ -703,14 +703,14 @@ class ValidateTest extends BaseTestCase
public function testContainsValid() public function testContainsValid()
{ {
$v = new Validator(array('test_string' => 'this is a Test')); $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()); $this->assertTrue($v->validate());
} }
public function testContainsStrictValid() public function testContainsNonStrictValid()
{ {
$v = new Validator(array('test_string' => 'this is a Test')); $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()); $this->assertTrue($v->validate());
} }
@ -724,7 +724,7 @@ class ValidateTest extends BaseTestCase
public function testContainsStrictNotFound() public function testContainsStrictNotFound()
{ {
$v = new Validator(array('test_string' => 'this is a Test')); $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()); $this->assertFalse($v->validate());
} }