function UploadedFileConstraintValidatorTest::setUp

Same name in other branches
  1. 11.x core/modules/file/tests/src/Kernel/Validation/UploadedFileConstraintValidatorTest.php \Drupal\Tests\file\Kernel\Validation\UploadedFileConstraintValidatorTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/file/tests/src/Kernel/Validation/UploadedFileConstraintValidatorTest.php, line 57

Class

UploadedFileConstraintValidatorTest
Tests the uploaded file validator.

Namespace

Drupal\Tests\file\Kernel\Validation

Code

protected function setUp() : void {
    parent::setUp();
    $fileSystem = $this->container
        ->get('file_system');
    $this->validator = $this->container
        ->get('validation.basic_recursive_validator_factory')
        ->createValidator();
    $this->filename = $this->randomMachineName() . '.txt';
    $this->path = 'temporary://' . $this->filename;
    $fileSystem->saveData('foo', $this->path);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.