You are here

public function EntityReferenceAutocompleteSynonymsWebTestCase::setUp in Synonyms 7

SetUp method.

Overrides AbstractAutocompleteSynonymsWebTestCase::setUp

File

./synonyms.test, line 966
Tests for the Synonyms module.

Class

EntityReferenceAutocompleteSynonymsWebTestCase
Test synonyms friendly autocomplete widget for entity reference field type.

Code

public function setUp($modules = array()) {
  $modules[] = 'entityreference';
  parent::setUp($modules);
  $this->reference_field = array(
    'type' => 'entityreference',
    'field_name' => 'synonyms_term_enabled',
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    'settings' => array(
      'target_type' => 'taxonomy_term',
      'handler_settings' => array(
        'target_bundles' => drupal_map_assoc(array(
          $this->fields['enabled']['instance']['bundle'],
        )),
      ),
    ),
  );
  $this->reference_field = field_create_field($this->reference_field);
  $this->reference_instance = array(
    'field_name' => $this->reference_field['field_name'],
    'entity_type' => 'node',
    'bundle' => $this->bundle,
    'label' => 'Synonym Entity Autcomplete',
    'widget' => array(
      'type' => 'synonyms_autocomplete_entity',
    ),
  );
  $this->reference_instance['widget']['settings'] = field_info_widget_settings($this->reference_instance['widget']['type']);
  $this->reference_instance = field_create_instance($this->reference_instance);
}