You are here

protected function ContentTranslationSyncImageTest::setupTestFields in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php \Drupal\content_translation\Tests\ContentTranslationSyncImageTest::setupTestFields()

Creates the test image field.

Overrides ContentTranslationTestBase::setupTestFields

File

core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php, line 48
Contains \Drupal\content_translation\Tests\ContentTranslationSyncImageTest.

Class

ContentTranslationSyncImageTest
Tests the field synchronization behavior for the image field.

Namespace

Drupal\content_translation\Tests

Code

protected function setupTestFields() {
  $this->fieldName = 'field_test_et_ui_image';
  $this->cardinality = 3;
  entity_create('field_storage_config', array(
    'field_name' => $this->fieldName,
    'entity_type' => $this->entityTypeId,
    'type' => 'image',
    'cardinality' => $this->cardinality,
  ))
    ->save();
  entity_create('field_config', array(
    'entity_type' => $this->entityTypeId,
    'field_name' => $this->fieldName,
    'bundle' => $this->entityTypeId,
    'label' => 'Test translatable image field',
    'third_party_settings' => array(
      'content_translation' => array(
        'translation_sync' => array(
          'file' => FALSE,
          'alt' => 'alt',
          'title' => 'title',
        ),
      ),
    ),
  ))
    ->save();
}