You are here

protected function TaxonomySynonymsBehaviorWebTestCase::createSynonymTerm in Synonyms 7

Supportive function.

Create a taxonomy term in the synonyms source vocabulary with the specified name.

Parameters

string $name: Name of the term to be created. If nothing is supplied a random string is used

Return value

object Fully loaded taxonomy term object of the just created term

1 call to TaxonomySynonymsBehaviorWebTestCase::createSynonymTerm()
TaxonomySynonymsBehaviorWebTestCase::testTaxonomyTermReference in synonyms_provider_field/synonyms_provider_field.test
Test synonyms extraction for 'taxonomy_term_reference' field type.

File

synonyms_provider_field/synonyms_provider_field.test, line 599
Tests for the Synonyms field provider module.

Class

TaxonomySynonymsBehaviorWebTestCase
Test TaxonomySynonymsBehavior class.

Code

protected function createSynonymTerm($name = NULL) {
  if (is_null($name)) {
    $name = $this
      ->randomName();
  }
  $synonym_term = (object) array(
    'name' => $name,
    'vid' => $this->vocabularySource->vid,
  );
  taxonomy_term_save($synonym_term);
  return $synonym_term;
}