You are here

protected function RelationshipUserImageDataTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/image/tests/src/Kernel/Views/RelationshipUserImageDataTest.php \Drupal\Tests\image\Kernel\Views\RelationshipUserImageDataTest::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/image/tests/src/Kernel/Views/RelationshipUserImageDataTest.php, line 41

Class

RelationshipUserImageDataTest
Tests image on user relationship handler.

Namespace

Drupal\Tests\image\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp($import_test_views);
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', [
    'file_usage',
  ]);
  $this
    ->installEntitySchema('user');

  // Create the user profile field and instance.
  FieldStorageConfig::create([
    'entity_type' => 'user',
    'field_name' => 'user_picture',
    'type' => 'image',
    'translatable' => '0',
  ])
    ->save();
  FieldConfig::create([
    'label' => 'User Picture',
    'description' => '',
    'field_name' => 'user_picture',
    'entity_type' => 'user',
    'bundle' => 'user',
    'required' => 0,
  ])
    ->save();
  ViewTestData::createTestViews(static::class, [
    'image_test_views',
  ]);
}