public function ExpressionValidatorTest::testFailingExpressionAtPropertyLevel in Plug 7
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ ExpressionValidatorTest.php, line 109
Class
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
public function testFailingExpressionAtPropertyLevel() {
$constraint = new Expression(array(
'expression' => 'value == this.data',
'message' => 'myMessage',
));
$object = new Entity();
$object->data = '1';
$this
->setRoot($object);
$this
->setPropertyPath('data');
$this
->setProperty($object, 'data');
$this->validator
->validate('2', $constraint);
$this
->buildViolation('myMessage')
->setParameter('{{ value }}', '"2"')
->atPath('data')
->assertRaised();
}