You are here

private function RestfulListTestCase::addIntegerFields in RESTful 7

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

Helper function; Add single and multiple integer fields.

1 call to RestfulListTestCase::addIntegerFields()
RestfulListTestCase::testFilter in tests/RestfulListTestCase.test
Test filtering.

File

tests/RestfulListTestCase.test, line 718
Contains RestfulListTestCase

Class

RestfulListTestCase
@file Contains RestfulListTestCase

Code

private function addIntegerFields() {

  // Integer - single.
  $field = array(
    'field_name' => 'integer_single',
    'type' => 'number_integer',
    'entity_types' => array(
      'node',
    ),
    'cardinality' => 1,
  );
  field_create_field($field);
  $instance = array(
    'field_name' => 'integer_single',
    'bundle' => 'article',
    'entity_type' => 'node',
    'label' => t('Integer single'),
  );
  field_create_instance($instance);

  // Integer - multiple.
  $field = array(
    'field_name' => 'integer_multiple',
    'type' => 'number_integer',
    'entity_types' => array(
      'node',
    ),
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
  );
  field_create_field($field);
  $instance = array(
    'field_name' => 'integer_multiple',
    'bundle' => 'article',
    'entity_type' => 'node',
    'label' => t('Integer multiple'),
  );
  field_create_instance($instance);
}