You are here

protected function FileEntityFormatterTest::setUp in Drupal 8

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

Overrides KernelTestBase::setUp

File

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

Class

FileEntityFormatterTest
Tests the default file formatter.

Namespace

Drupal\Tests\file\Kernel\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;
}