Skip to content

Instantly share code, notes, and snippets.

@rapzo
Created March 19, 2014 15:45
Show Gist options
  • Save rapzo/9644543 to your computer and use it in GitHub Desktop.
Save rapzo/9644543 to your computer and use it in GitHub Desktop.
<?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