コード例 #1
0
 /**
  * @covers Yosmanyga\Validation\Validator\ExpressionValueValidator::addVariable
  */
 public function testAddVariable()
 {
     $validator = new ExpressionValueValidator();
     $validator->addVariable('foo', 'bar');
     $r = new \ReflectionClass($validator);
     $p = $r->getProperty('variables');
     $p->setAccessible(true);
     $this->assertEquals(array('foo' => 'bar'), $p->getValue($validator));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function validate($object, $property)
 {
     $this->expressionValueValidator->addVariable('this', $object);
     $value = $this->propertyAccessor->getValue($object, $property);
     return $this->expressionValueValidator->validate($value);
 }