You are here

function FieldTestBase::setUpFieldStorages in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/Views/FieldTestBase.php \Drupal\field\Tests\Views\FieldTestBase::setUpFieldStorages()
3 calls to FieldTestBase::setUpFieldStorages()
FieldApiDataTest::setUp in core/modules/views/src/Tests/FieldApiDataTest.php
Sets up a Drupal site for running functional and integration tests.
FieldUITest::setUp in core/modules/field/src/Tests/Views/FieldUITest.php
Sets up a Drupal site for running functional and integration tests.
HandlerFieldFieldTest::setUp in core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php
Sets up a Drupal site for running functional and integration tests.

File

core/modules/field/src/Tests/Views/FieldTestBase.php, line 64
Contains \Drupal\field\Tests\Views\FieldTestBase.

Class

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

Namespace

Drupal\field\Tests\Views

Code

function setUpFieldStorages($amount = 3, $type = 'string') {

  // Create three fields.
  $field_names = array();
  for ($i = 0; $i < $amount; $i++) {
    $field_names[$i] = 'field_name_' . $i;
    $this->fieldStorages[$i] = entity_create('field_storage_config', array(
      'field_name' => $field_names[$i],
      'entity_type' => 'node',
      'type' => $type,
    ));
    $this->fieldStorages[$i]
      ->save();
  }
  return $field_names;
}