You are here

function ModuleGrantsBaseTestCase::createTerm in Module Grants 7

Returns a new term with random properties in vocabulary $vid. Copied from views_handler_relationship_node_term_data.test (2 matches)

1 call to ModuleGrantsBaseTestCase::createTerm()
ModuleGrantsBaseTestCase::assetNodeViewAccess in ./module_grants.test
node_accesses: array of node title => true/false

File

./module_grants.test, line 162

Class

ModuleGrantsBaseTestCase

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