function FieldTranslationsTestCase::setUp in Drupal 7
Set the default field storage backend for fields created during tests.
Overrides FieldTestCase::setUp
File
- modules/
field/ tests/ field.test, line 3084 - Tests for field.module.
Class
- FieldTranslationsTestCase
- Unit test class for the multilanguage fields logic.
Code
function setUp() {
parent::setUp('locale', 'field_test');
$this->field_name = drupal_strtolower($this
->randomName() . '_field_name');
$this->entity_type = 'test_entity';
$field = array(
'field_name' => $this->field_name,
'type' => 'test_field',
'cardinality' => 4,
'translatable' => TRUE,
);
field_create_field($field);
$this->field = field_read_field($this->field_name);
$instance = array(
'field_name' => $this->field_name,
'entity_type' => $this->entity_type,
'bundle' => 'test_bundle',
);
field_create_instance($instance);
$this->instance = field_read_instance('test_entity', $this->field_name, 'test_bundle');
require_once DRUPAL_ROOT . '/includes/locale.inc';
for ($i = 0; $i < 3; ++$i) {
locale_add_language('l' . $i, $this
->randomString(), $this
->randomString());
}
}