Esempio n. 1
0
 public function validate($value)
 {
     parent::validate($value);
     if (!is_a($value, $this->type, false)) {
         throw new ValidationException(sprintf('Object must be of type %s.', $this->type));
     }
     return true;
 }
Esempio n. 2
0
 /**
  * JsonValidator constructor.
  * @param array $ruleSet set of rules for JSON.
  */
 public function __construct(array $ruleSet)
 {
     parent::__construct(TypeOf::TYPE_ARRAY);
     $this->ruleSet = $ruleSet;
 }
Esempio n. 3
0
 /**
  * @dataProvider objectFailureValuesProvider
  * @expectedException \Alien\Constraint\Exception\ValidationException
  */
 public function testObjectFailure($nonObject)
 {
     $constraint = new Type(Type::TYPE_OBJECT);
     $constraint->validate($nonObject);
 }