You are here

protected function SynonymsWebTestCase::getLastTerm in Synonyms 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

1 call to SynonymsWebTestCase::getLastTerm()
TaxonomyTermReferenceAutocompleteSynonymsWebTestCase::testAutoCreation in ./synonyms.test
Test auto-creation functionality.

File

./synonyms.test, line 143
Tests for the Synonyms module.

Class

SynonymsWebTestCase
Base class for all Synonyms web test cases.

Code

protected function getLastTerm($vocabulary) {
  $tid = db_select('taxonomy_term_data', 't');
  $tid
    ->addExpression('MAX(t.tid)');
  $tid
    ->condition('vid', $vocabulary->vid);
  $tid = $tid
    ->execute()
    ->fetchField();
  return entity_load_unchanged('taxonomy_term', $tid);
}