function FormTest::setUp

Same name in this branch

Set the default field storage backend for fields created during tests.

Overrides FieldTestBase::setUp

File

drupal/core/modules/field/lib/Drupal/field/Tests/FormTest.php, line 27
Definition of Drupal\field\Tests\FormTest.

Class

FormTest

Namespace

Drupal\field\Tests

Code

function setUp() {
  parent::setUp();
  $web_user = $this
    ->drupalCreateUser(array(
    'access field_test content',
    'administer field_test content',
  ));
  $this
    ->drupalLogin($web_user);
  $this->field_single = array(
    'field_name' => 'field_single',
    'type' => 'test_field',
  );
  $this->field_multiple = array(
    'field_name' => 'field_multiple',
    'type' => 'test_field',
    'cardinality' => 4,
  );
  $this->field_unlimited = array(
    'field_name' => 'field_unlimited',
    'type' => 'test_field',
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
  );
  $this->instance = array(
    'entity_type' => 'test_entity',
    'bundle' => 'test_bundle',
    'label' => $this
      ->randomName() . '_label',
    'description' => '[site:name]_description',
    'weight' => mt_rand(0, 127),
    'settings' => array(
      'test_instance_setting' => $this
        ->randomName(),
    ),
    'widget' => array(
      'type' => 'test_field_widget',
      'label' => 'Test Field',
      'settings' => array(
        'test_widget_setting' => $this
          ->randomName(),
      ),
    ),
  );
}