You are here

function ViewsFieldApiTestHelper::setUpFields in Views (for Drupal 7) 7.3

2 calls to ViewsFieldApiTestHelper::setUpFields()
viewsFieldApiDataTest::setUp in tests/field/views_fieldapi.test
Sets up a Drupal site for running functional and integration tests.
viewsHandlerFieldFieldTest::setUp in tests/field/views_fieldapi.test
Sets up a Drupal site for running functional and integration tests.

File

tests/field/views_fieldapi.test, line 70
Tests the fieldapi integration of viewsdata.

Class

ViewsFieldApiTestHelper
Provides some helper methods for testing fieldapi integration into views.

Code

function setUpFields($amount = 3) {

  // Create three fields.
  $field_names = array();
  for ($i = 0; $i < $amount; $i++) {
    $field_names[$i] = 'field_name_' . $i;
    $field = array(
      'field_name' => $field_names[$i],
      'type' => 'text',
    );
    $this->fields[$i] = $field = field_create_field($field);
  }
  return $field_names;
}