You are here

protected function RedirectTermMergeWebTestCase::assertRedirectIntegration in Term Merge 7

Supportive method.

Assert expected results after doing any test actions.

Parameters

array $terms: Array of terms as returned by $this->createTerms(). Those terms that have been merged and redirected to another terms, besides all normal keys should have property 'redirect' which should be equal to the fully loaded taxonomy term which they were redirected to

string $message: Assert message to be shown on test results page

2 calls to RedirectTermMergeWebTestCase::assertRedirectIntegration()
RedirectTermMergeWebTestCase::testTermMergeAction in ./term_merge.test
Test the action 'term_merge_action' in terms of integration with Redirect.
RedirectTermMergeWebTestCase::testTermMergeBatch in ./term_merge.test
Test Term Merge batch in terms of integration with Redirect/Path modules.

File

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

Class

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

Code

protected function assertRedirectIntegration($terms, $message) {
  foreach ($terms as $term) {
    if (isset($term->redirect)) {
      $sources = array(
        'taxonomy/term/' . $term->tid,
      );

      // Additionally checking path alias.
      if (!in_array(drupal_get_path_alias($sources[0]), $sources)) {
        $sources[] = drupal_get_path_alias($sources[0]);
      }
      foreach ($sources as $source) {
        $this
          ->drupalGet($source);
        $this
          ->assertUrl('taxonomy/term/' . $term->redirect->tid, array(), $message);
      }

      // Additionally assert the 'taxonomy/term/*/feed' path.
      $sources = array(
        'taxonomy/term/' . $term->tid . '/feed',
      );
      if (!in_array(drupal_get_path_alias($sources[0]), $sources)) {
        $sources[] = drupal_get_path_alias($sources[0]);
      }
      foreach ($sources as $source) {
        $this
          ->drupalGet($source);
        $this
          ->assertUrl('taxonomy/term/' . $term->redirect->tid . '/feed', array(), $message);
      }
    }
  }
}