You are here

public function SynonymsTermMergeWebTestCase::testTermMergeBatch in Term Merge 7

Test Term Merge batch in terms of integration with Synonyms module.

File

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

Class

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

Code

public function testTermMergeBatch() {

  // Trying to merge without synonyms adding.
  $terms = $this
    ->createTerms(array(
    'branch',
    'trunk',
  ));
  $this
    ->drupalPost('taxonomy/term/' . $terms['branch']->tid . '/merge', array(
    'term_branch[]' => array(
      $terms['branch']->tid,
    ),
    'term_trunk[widget]' => 'select',
    'term_trunk[tid]' => $terms['trunk']->tid,
    'term_branch_keep' => TRUE,
    'synonyms' => '',
  ), 'Submit');
  $this
    ->drupalPost(NULL, array(), 'Confirm');
  $this
    ->assertSynonymsIntegration($terms, 'No synonyms are added after running merge batch when not instructed to add synonyms.');

  // Trying to merge into a term with synonyms adding.
  $this
    ->drupalPost('taxonomy/term/' . $terms['branch']->tid . '/merge', array(
    'term_branch[]' => array(
      $terms['branch']->tid,
    ),
    'term_trunk[widget]' => 'select',
    'term_trunk[tid]' => $terms['trunk']->tid,
    'term_branch_keep' => TRUE,
    'synonyms' => $this->behavior_implementation['provider'],
  ), 'Submit');
  $terms['trunk']->synonyms = array(
    $terms['branch']->name,
  );
  $this
    ->drupalPost(NULL, array(), 'Confirm');
  $this
    ->assertSynonymsIntegration($terms, 'Synonyms are added after running merge batch merging into an existing term, when instructed to add synonyms.');
}