You are here

public function ExpressionValidatorTest::testFailingExpressionAtPropertyLevelWithoutRoot in Zircon Profile 8.0

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

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

File

vendor/symfony/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();
}