You are here

protected function ValidatorTest::setUp in Drupal 9

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

Overrides FileManagedUnitTestBase::setUp

File

core/modules/file/tests/src/Kernel/ValidatorTest.php, line 28

Class

ValidatorTest
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->nonImage = File::create();
  $this->nonImage
    ->setFileUri('core/assets/vendor/jquery/jquery.min.js');
  $this->nonImage
    ->setFilename($file_system
    ->basename($this->nonImage
    ->getFileUri()));
}