You are here

protected function TermstatusWebTestCase::createTerm in Taxonomy Term Status 7

Returns a new term with random properties in vocabulary $vid.

3 calls to TermstatusWebTestCase::createTerm()
TermstatusAccessTestCase::setUp in ./termstatus.test
Return info about test case.
TermstatusQueryTagTestCase::setUp in ./termstatus.test
Sets up a Drupal site for running functional and integration tests.
TermstatusSafeguardTestCase::testFirstUseSafeguard in ./termstatus.test
Tests the first-use-safeguard mechanism.

File

./termstatus.test, line 33
Tests for termstatus.module

Class

TermstatusWebTestCase
Provides common helper methods for Taxonomy Term Status tests.

Code

protected function createTerm($vocabulary) {
  $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();
  $term->vid = $vocabulary->vid;
  taxonomy_term_save($term);
  return $term;
}