You are here

protected function TermMergeWebTestCase::getLastTerm in Term Merge 7

Return last inserted term into the specified vocabulary.

Parameters

object $vocabulary: Fully loaded taxonomy vocabulary object

Return value

object Fully loaded taxonomy term object of the last inserted term into the specified vocabulary

7 calls to TermMergeWebTestCase::getLastTerm()
DuplicatesTermMergeWebTestCase::createTerms in ./term_merge.test
Supportive method.
RedirectTermMergeWebTestCase::createTerms in ./term_merge.test
Supportive method.
SynonymsTermMergeWebTestCase::createTerms in ./term_merge.test
Supportive method.
TermMergeTermMergeWebTestCase::testTermMerge in ./term_merge.test
Test merging two terms.
TermMergeTermMergeWebTestCase::testTermMergeBatch in ./term_merge.test
Test all cases of usage of Term Merge Batch.

... See full list

File

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

Class

TermMergeWebTestCase
Base class for all tests of Term Merge module.

Code

protected function getLastTerm($vocabulary) {
  drupal_static_reset();
  $tree = taxonomy_get_tree($vocabulary->vid);
  $max = 0;
  $term = NULL;
  foreach ($tree as $v) {
    if ($v->tid > $max) {
      $max = $v->tid;
      $term = $v;
    }
  }
  $term = entity_load_unchanged('taxonomy_term', $term->tid);
  return $term;
}