function UploadedFileValidatorTest::setUp

Same name and namespace in other branches
  1. 10 core/modules/file/tests/src/Kernel/Validation/UploadedFileValidatorTest.php \Drupal\Tests\file\Kernel\Validation\UploadedFileValidatorTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/file/tests/src/Kernel/Validation/UploadedFileValidatorTest.php, line 56

Class

UploadedFileValidatorTest
Tests the uploaded file validator.

Namespace

Drupal\Tests\file\Kernel\Validation

Code

protected function setUp() : void {
    parent::setUp();
    $fileSystem = $this->container
        ->get('file_system');
    
    /** @var \Drupal\file\Validation\UploadedFileValidator $validator */
    $this->validator = new UploadedFileValidator($this->container
        ->get('validation.basic_recursive_validator_factory'));
    $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.