function ViewsFieldApiTestHelper::setUpFields

3.x views_fieldapi.test ViewsFieldApiTestHelper::setUpFields($amount = 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 63
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;
}