You are here

public function FileValidationTest::setUp in SVG Image Field 2.1.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/FileValidationTest.php \Drupal\Tests\svg_image_field\Unit\FileValidationTest::setUp()
  2. 2.0.x tests/src/Unit/FileValidationTest.php \Drupal\Tests\svg_image_field\Unit\FileValidationTest::setUp()

Set the default field storage backend for fields created during tests.

Overrides FieldKernelTestBase::setUp

File

tests/src/Unit/FileValidationTest.php, line 39

Class

FileValidationTest
Svg Image Field module unit tests.

Namespace

Drupal\Tests\svg_image_field\Unit

Code

public function setUp() {
  $this->testDataDirPath = dirname(__FILE__) . '/test_data';
  parent::setUp();
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', [
    'file_usage',
  ]);
  FieldStorageConfig::create([
    'field_name' => 'file_test',
    'entity_type' => 'entity_test',
    'type' => 'file',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'file_test',
    'bundle' => 'entity_test',
    'settings' => [
      'file_directory' => $this->testDataDirPath,
    ],
  ])
    ->save();
}