You are here

protected function ImageItemTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/src/Tests/ImageItemTest.php \Drupal\image\Tests\ImageItemTest::setUp()

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

Overrides FieldUnitTestBase::setUp

File

core/modules/image/src/Tests/ImageItemTest.php, line 41
Contains \Drupal\image\Tests\ImageItemTest.

Class

ImageItemTest
Tests using entity fields of the image field type.

Namespace

Drupal\image\Tests

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', array(
    'file_usage',
  ));
  entity_create('field_storage_config', array(
    'entity_type' => 'entity_test',
    'field_name' => 'image_test',
    'type' => 'image',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ))
    ->save();
  entity_create('field_config', array(
    'entity_type' => 'entity_test',
    'field_name' => 'image_test',
    'bundle' => 'entity_test',
  ))
    ->save();
  file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
  $this->image = entity_create('file', array(
    'uri' => 'public://example.jpg',
  ));
  $this->image
    ->save();
  $this->imageFactory = $this->container
    ->get('image.factory');
}