You are here

protected function ConflictWebTestCase::createFieldWithInstance in Conflict 7

1 call to ConflictWebTestCase::createFieldWithInstance()
ConflictTestCase::testComplexTroublesCase in ./conflict.test
Test case for complex errors.

File

./conflict.test, line 161
Tests for conflict.module.

Class

ConflictWebTestCase
@file Tests for conflict.module.

Code

protected function createFieldWithInstance($suffix, $field_type = 'text', $entity_type = 'node', $bundle = 'page') {
  $field_name = 'field_' . $suffix;
  $field = field_create_field(array(
    'field_name' => $field_name,
    'type' => $field_type,
    'cardinality' => 1,
  ));
  $instance = array(
    'field_name' => $field_name,
    'entity_type' => $entity_type,
    'bundle' => $bundle,
    'label' => $field_name,
    'description' => $this
      ->randomName() . '_description',
    'weight' => mt_rand(0, 127),
    'widget' => array(
      'type' => 'text_textfield',
    ),
  );
  field_create_instance($instance);
}