function FileValidatorTestBase::setUp

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

Overrides KernelTestBase::setUp

2 calls to FileValidatorTestBase::setUp()
FileImageDimensionsConstraintValidatorTest::setUp in core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileImageDimensionsConstraintValidatorTest.php
FileIsImageConstraintValidatorTest::setUp in core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileIsImageConstraintValidatorTest.php
2 methods override FileValidatorTestBase::setUp()
FileImageDimensionsConstraintValidatorTest::setUp in core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileImageDimensionsConstraintValidatorTest.php
FileIsImageConstraintValidatorTest::setUp in core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileIsImageConstraintValidatorTest.php

File

core/modules/file/tests/src/Kernel/Validation/FileValidatorTestBase.php, line 39

Class

FileValidatorTestBase
Provides a base file constraint validator test.

Namespace

Drupal\Tests\file\Kernel\Validation

Code

protected function setUp() : void {
    parent::setUp();
    $this->installConfig([
        'system',
    ]);
    $this->installEntitySchema('file');
    $this->installEntitySchema('user');
    $this->installSchema('file', [
        'file_usage',
    ]);
    $uri = 'public://druplicon.txt';
    $this->file = File::create([
        'uid' => 1,
        'uri' => $uri,
        'filename' => 'druplicon.txt',
        'filemime' => 'text/plain',
        'filesize' => 1000,
    ]);
    $this->file
        ->setPermanent();
    $this->validator = $this->container
        ->get('file.validator');
}

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