You are here

protected function RestfulViewEntityMultiLingualTestCase::addTestFields in RESTful 7

Same name and namespace in other branches
  1. 7.2 tests/RestfulViewEntityMultiLingualTestCase.test \RestfulViewEntityMultiLingualTestCase::addTestFields()

Add test fields.

1 call to RestfulViewEntityMultiLingualTestCase::addTestFields()
RestfulViewEntityMultiLingualTestCase::setUp in tests/RestfulViewEntityMultiLingualTestCase.test
Sets up a Drupal site for running functional and integration tests.

File

tests/RestfulViewEntityMultiLingualTestCase.test, line 53
Contains RestfulViewEntityMultiLingualTestCase

Class

RestfulViewEntityMultiLingualTestCase
@file Contains RestfulViewEntityMultiLingualTestCase

Code

protected function addTestFields() {

  // Text - single.
  $field = array(
    'field_name' => 'text_single',
    'type' => 'text_long',
    'entity_types' => array(
      'restful_test_translatable_entity',
    ),
    'cardinality' => 1,
    'translatable' => TRUE,
  );
  field_create_field($field);
  $instance = array(
    'field_name' => 'text_single',
    'bundle' => 'restful_test_translatable_entity',
    'entity_type' => 'restful_test_translatable_entity',
    'label' => t('Text single'),
    'settings' => array(
      'text_processing' => 0,
    ),
  );
  field_create_instance($instance);

  // Text - multiple.
  $field = array(
    'field_name' => 'text_multiple',
    'type' => 'text_long',
    'entity_types' => array(
      'restful_test_translatable_entity',
    ),
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    'translatable' => TRUE,
  );
  field_create_field($field);
  $instance = array(
    'field_name' => 'text_multiple',
    'bundle' => 'restful_test_translatable_entity',
    'entity_type' => 'restful_test_translatable_entity',
    'label' => t('Text multiple'),
    'settings' => array(
      'text_processing' => 0,
    ),
  );
  field_create_instance($instance);
}