ExpressionLanguageSyntaxValidator example

use Symfony\Component\Validator\Constraints\ExpressionLanguageSyntaxValidator;
use Symfony\Component\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

/** * @group legacy */
class ExpressionLanguageSyntaxValidatorTest extends ConstraintValidatorTestCase
{
    protected function createValidator(): ConstraintValidatorInterface
    {
        return new ExpressionLanguageSyntaxValidator(new ExpressionLanguage());
    }

    public function testExpressionValid()
    {
        $this->validator->validate('1 + 1', new ExpressionLanguageSyntax([
            'message' => 'myMessage',
            'allowedVariables' => [],
        ]));

        $this->assertNoViolation();
    }

    
Home | Imprint | This part of the site doesn't use cookies.