You are here

function ServicesResourceTaxonomyTests::testVocabularyUpdateLegacy in Services 7.3

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

Test taxonomy vocabulary update (Legacy).

TODO: To be removed in future version.

See also

http://drupal.org/node/1083242

File

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

Class

ServicesResourceTaxonomyTests
Taxonomy resource test class.

Code

function testVocabularyUpdateLegacy() {
  $path = $this->endpoint->path;
  $vocabulary = $this
    ->createVocabulary();
  $vid = $vocabulary['vid'];
  $vocabulary['name'] = $this
    ->randomName();
  $vocabulary['description'] = $this
    ->randomString();
  $response = $this
    ->servicesPUT($path . '/taxonomy_vocabulary/' . $vid, array(
    'vocabulary' => $vocabulary,
  ));

  // Load vocabulary from database. We use entity_load to reset static cache.
  $vocabularies_load = entity_load('taxonomy_vocabulary', array(
    $vid,
  ), array(), TRUE);
  $vocabulary_load = (array) array_pop($vocabularies_load);
  $vocabulary_intersect = array_intersect_assoc($vocabulary, $vocabulary_load);
  $this
    ->assertEqual($vocabulary, $vocabulary_intersect, 'Taxonomy vocabulary updated properly.', 'TaxonomyVocabularyResource: Update (Legacy)');
}