You are here

public function RedirectTermMergeWebTestCase::testTermMergeBatch in Term Merge 7

Test Term Merge batch in terms of integration with Redirect/Path modules.

File

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

Class

RedirectTermMergeWebTestCase
Test the integration between Term Merge module and Path/Redirect modules.

Code

public function testTermMergeBatch() {
  $this
    ->drupalLogin($this->superAdmin);

  // Trying to merge without redirection.
  $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,
    'redirect' => TERM_MERGE_NO_REDIRECT,
  ), 'Submit');
  $this
    ->drupalPost(NULL, array(), 'Confirm');
  $this
    ->assertRedirectIntegration($terms, 'No redirection made after running merge batch when not instructed to make redirection.');

  // Trying to merge into a term with redirection.
  $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,
    'redirect' => 0,
  ), 'Submit');
  $terms['branch']->redirect = $terms['trunk'];
  $this
    ->drupalPost(NULL, array(), 'Confirm');
  $this
    ->assertRedirectIntegration($terms, 'Redirection is made after running merge batch merging into an existing term, when instructed to make redirection.');
}