You are here

function ServicesResourceNodeTaxonomytests::createTerm in Services 7.3

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

1 call to ServicesResourceNodeTaxonomytests::createTerm()
ServicesResourceNodeTaxonomytests::testServicesTaxonomyNode in tests/functional/ServicesResourceNodeTests.test
Test that hook_node_$op implementations work correctly.

File

tests/functional/ServicesResourceNodeTests.test, line 604
Call the endpoint tests when no authentication is being used.

Class

ServicesResourceNodeTaxonomytests
Test create node with taxonomy terms attached.

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