You are here

public function TaxonomyTermReferenceAutocompleteSynonymsWebTestCase::setUp in Synonyms 7

SetUp method.

Overrides AbstractAutocompleteSynonymsWebTestCase::setUp

File

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

Class

TaxonomyTermReferenceAutocompleteSynonymsWebTestCase
Test synonyms friendly autocomplete widget for taxonomy term reference field.

Code

public function setUp($modules = array()) {
  parent::setUp($modules);
  $this->reference_field = array(
    'type' => 'taxonomy_term_reference',
    'field_name' => 'synonyms_term_enabled',
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    'settings' => array(
      'allowed_values' => array(
        array(
          'vocabulary' => $this->vocabulary->machine_name,
          'parent' => 0,
        ),
      ),
    ),
  );
  $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 Terms Autcomplete',
    'widget' => array(
      'type' => 'synonyms_autocomplete_taxonomy_term',
    ),
  );
  $this->reference_instance['widget']['settings'] = field_info_widget_settings($this->reference_instance['widget']['type']);
  $this->reference_instance = field_create_instance($this->reference_instance);
}