You are here

protected function ExtensionViewsFieldTest::setUp in Zircon Profile 8

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

Parameters

bool $import_test_views: Should the views specififed on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides ViewKernelTestBase::setUp

File

core/modules/file/src/Tests/Views/ExtensionViewsFieldTest.php, line 38
Contains \Drupal\file\Tests\Views\ExtensionViewsFieldTest.

Class

ExtensionViewsFieldTest
Tests the core Drupal\file\Plugin\views\field\Extension handler.

Namespace

Drupal\file\Tests\Views

Code

protected function setUp() {
  parent::setUp();
  ViewTestData::createTestViews(get_class($this), array(
    'file_test_views',
  ));
  $this
    ->installEntitySchema('file');
  file_put_contents('public://file.png', '');
  File::create([
    'uri' => 'public://file.png',
    'filename' => 'file.png',
  ])
    ->save();
  file_put_contents('public://file.tar', '');
  File::create([
    'uri' => 'public://file.tar',
    'filename' => 'file.tar',
  ])
    ->save();
  file_put_contents('public://file.tar.gz', '');
  File::create([
    'uri' => 'public://file.tar.gz',
    'filename' => 'file.tar.gz',
  ])
    ->save();
  file_put_contents('public://file', '');
  File::create([
    'uri' => 'public://file',
    'filename' => 'file',
  ])
    ->save();
}