Created
March 19, 2014 15:45
-
-
Save rapzo/9644543 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace jojo\tests\cases\extensions\util; | |
use lithium\util\Validator; | |
class ValidatorTest extends \lithium\test\Unit { | |
public function setUp() { | |
} | |
public function tearDown() { | |
} | |
public function testNestedValidation() { | |
$data = [ | |
'field' => [ | |
'one' => 'foo' | |
], | |
'baz' => '' | |
]; | |
$rules = [ | |
'field.one' => [ | |
'notEmpty', | |
'required' => false, | |
'skipEmpty' => true, | |
'message' => 'Error on field one.' | |
], | |
'field.two' => [ | |
'notEmpty', | |
'required' => false, | |
'skipEmpty' => true, | |
'message' => 'Error on field two.' | |
], | |
'baz' => [ | |
'notEmpty', | |
'required' => false, | |
'skipEmpty' => true, | |
'message' => 'Error on field baz.' | |
] | |
]; | |
$result = Validator::check($data, $rules); | |
$this->assertEmpty($result); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment