mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Added test
This commit is contained in:
parent
89352fcc15
commit
da56650a52
@ -623,6 +623,34 @@ class ValidateTest extends BaseTestCase
|
||||
$v->rule('testRule', 'name', array('foo', 'bar'))->message('Invalid name selected.');
|
||||
$this->assertFalse($v->validate());
|
||||
}
|
||||
|
||||
public function testBooleanValid()
|
||||
{
|
||||
$v = new Validator(array('test' => true));
|
||||
$v->rule('boolean', 'test');
|
||||
$this->assertTrue($v->validate());
|
||||
}
|
||||
|
||||
public function testBooleanInvalid()
|
||||
{
|
||||
$v = new Validator(array('test' => 'true'));
|
||||
$v->rule('boolean', 'test');
|
||||
$this->assertFalse($v->validate());
|
||||
}
|
||||
|
||||
public function testBooleanStringValid()
|
||||
{
|
||||
$v = new Validator(array('test' => "true"));
|
||||
$v->rule('boolean', 'test', true);
|
||||
$this->assertTrue($v->validate());
|
||||
}
|
||||
|
||||
public function testBooleanStringInvalid()
|
||||
{
|
||||
$v = new Validator(array('test' => 'notrue'));
|
||||
$v->rule('boolean', 'test', true);
|
||||
$this->assertFalse($v->validate());
|
||||
}
|
||||
}
|
||||
|
||||
function sampleFunctionCallback($field, $value, array $params) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user