You are here

public function ExpressionValidatorTest::testFailingExpressionAtObjectLevel in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\ExpressionValidatorTest::testFailingExpressionAtObjectLevel()

File

vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php, line 74

Class

ExpressionValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testFailingExpressionAtObjectLevel() {
  $constraint = new Expression(array(
    'expression' => 'this.data == 1',
    'message' => 'myMessage',
  ));
  $object = new Entity();
  $object->data = '2';
  $this
    ->setObject($object);
  $this->validator
    ->validate($object, $constraint);
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ value }}', 'object')
    ->assertRaised();
}