You are here

public function SynonymsTermMergeWebTestCase::testTermMergeAction in Term Merge 7

Test the action 'term_merge_action' in terms of integration with Synonyms.

File

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

Class

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

Code

public function testTermMergeAction() {
  $this
    ->drupalLogin($this->admin);
  $terms = $this
    ->createTerms(array(
    'branch',
    'trunk',
  ));

  // Testing default value.
  actions_do('term_merge_action', $terms['branch'], array(
    'term_trunk' => $terms['trunk']->tid,
    'term_branch_keep' => TRUE,
  ));
  $this
    ->assertSynonymsIntegration($terms, 'By default no synonyms should be added.');

  // Testing no synonyms adding.
  actions_do('term_merge_action', $terms['branch'], array(
    'term_trunk' => $terms['trunk']->tid,
    'term_branch_keep' => TRUE,
    'synonyms' => NULL,
  ));
  $this
    ->assertSynonymsIntegration($terms, 'No synonyms are added, if action is not instructed to make ones.');

  // Testing adding as a synonym.
  actions_do('term_merge_action', $terms['branch'], array(
    'term_trunk' => $terms['trunk']->tid,
    'synonyms' => $this->behavior_implementation['provider'],
  ));
  $terms['trunk']->synonyms = array(
    $terms['branch']->name,
  );
  $this
    ->assertSynonymsIntegration($terms, 'Synonyms are added, if action is instructed to add ones.');
}