You are here

function MonitoringCoreTest::createTerm in Monitoring 7

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

Return value

object Term object.

1 call to MonitoringCoreTest::createTerm()
MonitoringCoreTest::testGenericDBAggregate in test/tests/monitoring.core.test
Tests the watchdog entries aggregator.

File

test/tests/monitoring.core.test, line 817
Contains \MonitoringCoreTest.

Class

MonitoringCoreTest
Tests for cron sensor.

Code

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;
}