/** * @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)); }
/** * {@inheritdoc} */ public function validate($object, $property) { $this->expressionValueValidator->addVariable('this', $object); $value = $this->propertyAccessor->getValue($object, $property); return $this->expressionValueValidator->validate($value); }