protected function EntityTranslationTestBase::setupTestFields

Creates the test fields.

2 calls to EntityTranslationTestBase::setupTestFields()
CommentTranslationUITest::setupTestFields in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::setupTestFields().
EntityTranslationTestBase::setUp in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php
Sets up a Drupal site for running functional and integration tests.
3 methods override EntityTranslationTestBase::setupTestFields()
CommentTranslationUITest::setupTestFields in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::setupTestFields().
ConfigTestTranslationUITest::setupTestFields in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/ConfigTestTranslationUITest.php
Overrides EntityTranslationUITest::setupTestFields().
EntityTranslationSyncImageTest::setupTestFields in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php
Creates the test image field.

File

drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php, line 161
Contains \Drupal\entity\Tests\EntityTranslationTestBase.

Class

EntityTranslationTestBase
Tests entity translation workflows.

Namespace

Drupal\translation_entity\Tests

Code

protected function setupTestFields() {
  $this->fieldName = 'field_test_et_ui_test';
  $field = array(
    'field_name' => $this->fieldName,
    'type' => 'text',
    'cardinality' => 1,
    'translatable' => TRUE,
  );
  field_create_field($field);
  $instance = array(
    'entity_type' => $this->entityType,
    'field_name' => $this->fieldName,
    'bundle' => $this->bundle,
    'label' => 'Test translatable text-field',
  );
  field_create_instance($instance);
  entity_get_form_display($this->entityType, $this->bundle, 'default')
    ->setComponent($this->fieldName, array(
    'type' => 'text_textfield',
    'weight' => 0,
  ))
    ->save();
}