Closed pcelta closed 10 years ago
New obejct validation.
Can be validated: public properties and properties with getter method. Example:
class Mock { private $name; public $lastName; private $creditCard = "unaccessible"; public function getName() { return $this->name; } public function setName($name) { $this->name = $name; } } $mock = new Mock(); $mock->setName("pedro"); $mock->lastName = "ribeiro"; $config['registering'] = array( 'name' => v::maxLength(50), 'lastName' => v::maxLength(50), ); $validationObject = ValidationGroupsFactory::build(new ArrayParserObjectStrategy($config)); $validationObject->validate($mock, "registering"); // true
phpunit src/Melody/Validation/ValidationObjectTest.php PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /home/pedro/dev/validator/tests/phpunit.xml.dist
.....
Time: 72 ms, Memory: 3.25Mb
OK (5 tests, 6 assertions)
New obejct validation.
Can be validated: public properties and properties with getter method. Example:
PHPUnit Report:
phpunit src/Melody/Validation/ValidationObjectTest.php PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /home/pedro/dev/validator/tests/phpunit.xml.dist
.....
Time: 72 ms, Memory: 3.25Mb
OK (5 tests, 6 assertions)