You are here

function ServicesResourceTaxonomyTests::testVocabularyUpdate in Services 7.3

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

Test taxonomy vocabulary update.

File

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

Class

ServicesResourceTaxonomyTests
Taxonomy resource test class.

Code

function testVocabularyUpdate() {
  $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, $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');
}