You are here

public function SynonymsTermMergeWebTestCase::setUp in Term Merge 7

SetUp method.

Overrides TermMergeWebTestCase::setUp

File

./term_merge.test, line 1331
Test the Term Merge module.

Class

SynonymsTermMergeWebTestCase
Test the integration between Term Merge module and Synonyms module.

Code

public function setUp() {
  $modules = $this
    ->normalizeSetUpArguments(func_get_args());
  $modules[] = 'synonyms';
  $modules[] = 'synonyms_provider_field';
  parent::setUp($modules);

  // Additionally we enable default synonyms field in the vocabulary.
  $this->field = field_create_field($this->field);
  $instance = array(
    'field_name' => $this->field['field_name'],
    'label' => 'Testing term merge synonyms integration',
    'entity_type' => 'taxonomy_term',
    'bundle' => $this->vocabulary->machine_name,
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
  );
  $instance = field_create_instance($instance);
  $instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']);
  $this->behavior_implementation = array(
    'entity_type' => $instance['entity_type'],
    'bundle' => $instance['bundle'],
    'provider' => synonyms_provider_field_provider_name($this->field),
    'behavior' => 'term_merge',
    'settings' => array(),
  );
  synonyms_behavior_implementation_save($this->behavior_implementation);
  foreach (synonyms_behavior_get($this->behavior_implementation['behavior'], $this->behavior_implementation['entity_type'], $this->behavior_implementation['bundle'], TRUE) as $behavior_implementation) {
    if ($behavior_implementation['provider'] == $this->behavior_implementation['provider']) {
      $this->behavior_implementation = $behavior_implementation;
      break;
    }
  }
}