function ExtensionViewsFieldTest::setUp

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

Overrides ViewsKernelTestBase::setUp

File

core/modules/file/tests/src/Kernel/Views/ExtensionViewsFieldTest.php, line 33

Class

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

Namespace

Drupal\Tests\file\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) {
    parent::setUp();
    ViewTestData::createTestViews(get_class($this), [
        '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();
}

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