mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-31 07:01:54 +00:00
Change contains validator default mode to strict
This commit is contained in:
parent
a89c0972c1
commit
d47c6206ed
@ -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];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user