You are here

protected function ImageThemeFunctionTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php \Drupal\Tests\image\Kernel\ImageThemeFunctionTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php, line 54

Class

ImageThemeFunctionTest
Tests image theme functions.

Namespace

Drupal\Tests\image\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', [
    'file_usage',
  ]);
  $this
    ->installEntitySchema('user');
  FieldStorageConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'image_test',
    'type' => 'image',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'image_test',
    'bundle' => 'entity_test',
  ])
    ->save();
  \Drupal::service('file_system')
    ->copy($this->root . '/core/misc/druplicon.png', 'public://example.jpg');
  $this->image = File::create([
    'uri' => 'public://example.jpg',
  ]);
  $this->image
    ->save();
  $this->imageFactory = $this->container
    ->get('image.factory');
}