protected function ExtensionViewsFieldTest::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/modules/file/tests/src/Kernel/Views/ExtensionViewsFieldTest.php \Drupal\Tests\file\Kernel\Views\ExtensionViewsFieldTest::setUp()
- 9 core/modules/file/tests/src/Kernel/Views/ExtensionViewsFieldTest.php \Drupal\Tests\file\Kernel\Views\ExtensionViewsFieldTest::setUp()
Parameters
bool $import_test_views: Should the views specified 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 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\ViewsCode
protected function setUp($import_test_views = TRUE) : void {
parent::setUp();
ViewTestData::createTestViews(static::class, [
'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();
}