You are here

function ServicesResourceNodeTaxonomytests::createVocabulary in Services 7.3

Returns a new vocabulary with random properties.

1 call to ServicesResourceNodeTaxonomytests::createVocabulary()
ServicesResourceNodeTaxonomytests::setUp in tests/functional/ServicesResourceNodeTests.test
Sets up a Drupal site for running functional and integration tests.

File

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

Class

ServicesResourceNodeTaxonomytests
Test create node with taxonomy terms attached.

Code

function createVocabulary() {

  // Create a vocabulary.
  $vocabulary = new stdClass();
  $vocabulary->name = $this
    ->randomName();
  $vocabulary->description = $this
    ->randomName();
  $vocabulary->machine_name = drupal_strtolower($this
    ->randomName());
  $vocabulary->help = '';
  $vocabulary->nodes = array(
    'article' => 'article',
  );
  $vocabulary->weight = mt_rand(0, 10);
  taxonomy_vocabulary_save($vocabulary);
  return $vocabulary;
}