You are here

protected function FileEntityFormatterTest::setUp in Zircon Profile 8.0

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

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

File

core/modules/file/src/Tests/Formatter/FileEntityFormatterTest.php, line 37
Contains \Drupal\file\Tests\Formatter\FileEntityFormatterTest.

Class

FileEntityFormatterTest
Tests the default file formatter.

Namespace

Drupal\file\Tests\Formatter

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('file');
  $this->files = [];
  file_put_contents('public://file.png', str_repeat('t', 10));
  $file = File::create([
    'uri' => 'public://file.png',
    'filename' => 'file.png',
  ]);
  $file
    ->save();
  $this->files[] = $file;
  file_put_contents('public://file.tar', str_repeat('t', 200));
  $file = File::create([
    'uri' => 'public://file.tar',
    'filename' => 'file.tar',
  ]);
  $file
    ->save();
  $this->files[] = $file;
  file_put_contents('public://file.tar.gz', str_repeat('t', 40000));
  $file = File::create([
    'uri' => 'public://file.tar.gz',
    'filename' => 'file.tar.gz',
  ]);
  $file
    ->save();
  $this->files[] = $file;
  file_put_contents('public://file', str_repeat('t', 8000000));
  $file = File::create([
    'uri' => 'public://file',
    'filename' => 'file',
  ]);
  $file
    ->save();
  $this->files[] = $file;
}