function FileItemValidationTest::setUp

Same name in other branches
  1. 8.9.x core/modules/file/tests/src/Kernel/FileItemValidationTest.php \Drupal\Tests\file\Kernel\FileItemValidationTest::setUp()
  2. 10 core/modules/file/tests/src/Kernel/FileItemValidationTest.php \Drupal\Tests\file\Kernel\FileItemValidationTest::setUp()
  3. 11.x core/modules/file/tests/src/Kernel/FileItemValidationTest.php \Drupal\Tests\file\Kernel\FileItemValidationTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/file/tests/src/Kernel/FileItemValidationTest.php, line 42

Class

FileItemValidationTest
Tests that files referenced in file and image fields are always validated.

Namespace

Drupal\Tests\file\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('entity_test');
    $this->installEntitySchema('user');
    $this->installEntitySchema('file');
    $this->installSchema('file', 'file_usage');
    $this->installSchema('system', 'sequences');
    $this->user = User::create([
        'name' => 'username',
        'status' => 1,
    ]);
    $this->user
        ->save();
    $this->container
        ->get('current_user')
        ->setAccount($this->user);
}

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