function LegacyValidatorTest::setUp

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

Overrides FileManagedUnitTestBase::setUp

File

core/modules/file/tests/src/Kernel/LegacyValidatorTest.php, line 32

Class

LegacyValidatorTest
Tests the functions used to validate uploaded files.

Namespace

Drupal\Tests\file\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->image = File::create();
    $this->image
        ->setFileUri('core/misc/druplicon.png');
    
    /** @var \Drupal\Core\File\FileSystemInterface $file_system */
    $file_system = \Drupal::service('file_system');
    $this->image
        ->setFilename($file_system->basename($this->image
        ->getFileUri()));
    $this->image
        ->setSize(@filesize($this->image
        ->getFileUri()));
    $this->nonImage = File::create();
    $this->nonImage
        ->setFileUri('core/assets/vendor/jquery/jquery.min.js');
    $this->nonImage
        ->setFilename($file_system->basename($this->nonImage
        ->getFileUri()));
}

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