You are here

function FieldTestBase::setUpFields in Views (for Drupal 7) 8.3

2 calls to FieldTestBase::setUpFields()
ApiDataTest::setUp in lib/Drupal/views/Tests/Field/ApiDataTest.php
Sets up a Drupal site for running functional and integration tests.
HandlerFieldFieldTest::setUp in lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php
Sets up a Drupal site for running functional and integration tests.

File

lib/Drupal/views/Tests/Field/FieldTestBase.php, line 40
Definition of Drupal\views\Test\Field\FieldTestBase.

Class

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

Namespace

Drupal\views\Tests\Field

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;
}