You are here

protected function ContentTranslationSyncImageTest::setupTestFields in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSyncImageTest::setupTestFields()
  2. 10 core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSyncImageTest::setupTestFields()

Creates the test image field.

Overrides ContentTranslationTestBase::setupTestFields

File

core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php, line 63

Class

ContentTranslationSyncImageTest
Tests the field synchronization behavior for the image field.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function setupTestFields() {
  $this->fieldName = 'field_test_et_ui_image';
  $this->cardinality = 3;
  FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'entity_type' => $this->entityTypeId,
    'type' => 'image',
    'cardinality' => $this->cardinality,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => $this->entityTypeId,
    'field_name' => $this->fieldName,
    'bundle' => $this->entityTypeId,
    'label' => 'Test translatable image field',
    'third_party_settings' => [
      'content_translation' => [
        'translation_sync' => [
          'file' => FALSE,
          'alt' => 'alt',
          'title' => 'title',
        ],
      ],
    ],
  ])
    ->save();
}