You are here

protected function FileManagedUnitTestBase::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Tests/FileManagedUnitTestBase.php \Drupal\file\Tests\FileManagedUnitTestBase::setUp()

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

2 calls to FileManagedUnitTestBase::setUp()
SpaceUsedTest::setUp in core/modules/file/src/Tests/SpaceUsedTest.php
Performs setup tasks before each individual test method is run.
ValidatorTest::setUp in core/modules/file/src/Tests/ValidatorTest.php
Performs setup tasks before each individual test method is run.
2 methods override FileManagedUnitTestBase::setUp()
SpaceUsedTest::setUp in core/modules/file/src/Tests/SpaceUsedTest.php
Performs setup tasks before each individual test method is run.
ValidatorTest::setUp in core/modules/file/src/Tests/ValidatorTest.php
Performs setup tasks before each individual test method is run.

File

core/modules/file/src/Tests/FileManagedUnitTestBase.php, line 26
Contains \Drupal\file\Tests\FileManagedUnitTestBase.

Class

FileManagedUnitTestBase
Base class for file unit tests that use the file_test module to test uploads and hooks.

Namespace

Drupal\file\Tests

Code

protected function setUp() {
  parent::setUp();

  // Clear out any hook calls.
  file_test_reset();
  $this
    ->installConfig(array(
    'system',
  ));
  $this
    ->installEntitySchema('file');
  $this
    ->installEntitySchema('user');
  $this
    ->installSchema('file', array(
    'file_usage',
  ));

  // Make sure that a user with uid 1 exists, self::createFile() relies on
  // it.
  $user = entity_create('user', array(
    'uid' => 1,
    'name' => $this
      ->randomMachineName(),
  ));
  $user
    ->enforceIsNew();
  $user
    ->save();
  \Drupal::currentUser()
    ->setAccount($user);
}