You are here

public function ExpressionValidatorTest::testFailingExpressionAtPropertyLevelWithoutRoot in Plug 7

When validatePropertyValue() is called with a class name https://github.com/symfony/symfony/pull/11498

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php, line 196

Class

ExpressionValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testFailingExpressionAtPropertyLevelWithoutRoot() {
  $constraint = new Expression(array(
    'expression' => 'value == "1"',
    'message' => 'myMessage',
  ));
  $this
    ->setRoot('2');
  $this
    ->setPropertyPath('');
  $this
    ->setProperty(null, 'property');
  $this->validator
    ->validate('2', $constraint);
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ value }}', '"2"')
    ->atPath('')
    ->assertRaised();
}