You are here

function EntityDependencyTestCase::createTerm in Entity Dependency API 7

Code taken from TaxonomyWebTestCase::createTerm() since we can't extend that test case. Some simplifications are made though.

@todo This will probably not work when the Testing profile is used. Then we need to create the vocabulary manually.

See also

TaxonomyWebTestCase::createTerm()

2 calls to EntityDependencyTestCase::createTerm()
EntityDependencyTestCase::testCumbersomeIterator in ./entity_dependency.test
Test cumbersome scenario with nodes, taxonomy and users.
EntityDependencyTestCase::testDanglingTermReferenceIterator in ./entity_dependency.test
Test worse scenario with nodes, taxonomy and dangling reference to taxonomy term.

File

./entity_dependency.test, line 48
Entity Dependency tests.

Class

EntityDependencyTestCase
Tests the entity dependency iterator.

Code

function createTerm() {
  $term = new stdClass();
  $term->name = $this
    ->randomName();
  $term->description = $this
    ->randomName();

  // Use the first available text format.
  $term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)
    ->fetchField();

  // For our test cases it's enough to rely on the standard 'tags' vocabulary.
  $term->vid = 1;
  taxonomy_term_save($term);
  return $term;
}