Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConstraintValidatorTestCase.php

function ConstraintValidatorTestCase::setUp

Overrides TestCase::setUp

File

vendor/symfony/validator/Test/ConstraintValidatorTestCase.php, line 68

Class

ConstraintValidatorTestCase
A test case to ease testing Constraint Validators.

Namespace

Symfony\Component\Validator\Test

Code

protected function setUp() : void {
    $this->group = 'MyGroup';
    $this->metadata = null;
    $this->object = null;
    $this->value = 'InvalidValue';
    $this->root = 'root';
    $this->propertyPath = 'property.path';
    // Initialize the context with some constraint so that we can
    // successfully build a violation.
    $this->constraint = new NotNull();
    $this->context = $this->createContext();
    $this->validator = $this->createValidator();
    $this->validator
        ->initialize($this->context);
    if (class_exists(\Locale::class)) {
        $this->defaultLocale = \Locale::getDefault();
        \Locale::setDefault('en');
    }
    $this->expectedViolations = [];
    $this->call = 0;
    $this->setDefaultTimezone('UTC');
}
RSS feed
Powered by Drupal