mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Tests for associative arrays
This commit is contained in:
parent
eace42656a
commit
ec0543be10
@ -315,6 +315,28 @@ class ValidateTest extends BaseTestCase
|
||||
$this->assertTrue($v->validate());
|
||||
}
|
||||
|
||||
public function testForeachAssocValues()
|
||||
{
|
||||
$v = new Validator(array('values' => array(
|
||||
'foo' => 5,
|
||||
'bar' => 10,
|
||||
'baz' => 15
|
||||
)));
|
||||
$v->rule('integer', 'values.*');
|
||||
$this->assertTrue($v->validate());
|
||||
}
|
||||
|
||||
public function testForeachAssocValuesFails()
|
||||
{
|
||||
$v = new Validator(array('values' => array(
|
||||
'foo' => 5,
|
||||
'bar' => 10,
|
||||
'baz' => 'faz'
|
||||
)));
|
||||
$v->rule('integer', 'values.*');
|
||||
$this->assertFalse($v->validate());
|
||||
}
|
||||
|
||||
public function testForeachArrayAccess()
|
||||
{
|
||||
$v = new Validator(array('settings' => array(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user