You are here

function ServicesResourceTaxonomyTests::testVocabularyCreateLegacy in Services 6.3

Same name and namespace in other branches
  1. 7.3 tests/functional/ServicesResourceTaxonomyTests.test \ServicesResourceTaxonomyTests::testVocabularyCreateLegacy()

Test taxonomy vocabulary create method (Legacy).

TODO: To be removed in future version.

See also

http://drupal.org/node/1083242

File

tests/functional/ServicesResourceTaxonomyTests.test, line 85

Class

ServicesResourceTaxonomyTests
Run test cases for the endpoint with no authentication turned on.

Code

function testVocabularyCreateLegacy() {
  $path = $this->endpoint->path;
  $vocabulary = array(
    'name' => $this
      ->randomName(),
    'description' => $this
      ->randomString(),
    'help' => $this
      ->randomString(),
    'relations' => 1,
    'hierarchy' => 1,
    'multiple' => 1,
    'required' => 0,
    'module' => 'services',
    'weight' => 0,
  );
  $response = $this
    ->servicesPost($path . '/taxonomy_vocabulary', array(
    'vocabulary' => $vocabulary,
  ));
  $vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name = "%s"', $vocabulary['name']));
  $vocabulary_load = (array) taxonomy_vocabulary_load($vid);
  $vocabulary_intersect = array_intersect_assoc($response['body'], $vocabulary_load);
  $this
    ->assertEqual($vocabulary['name'], $response['body']['name'], t('Taxonomy vocabulary created properly.'), 'TaxonomyVocabularyResource: Create (Legacy)');
}