You are here

function ServicesResourceTaxonomyTests::testTermUpdate in Services 7.3

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

Test taxonomy term update method.

File

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

Class

ServicesResourceTaxonomyTests
Taxonomy resource test class.

Code

function testTermUpdate() {
  $path = $this->endpoint->path;
  $vocabulary = $this
    ->createVocabulary();
  $term = $this
    ->createTerm($vocabulary['vid']);
  $term_update_data = array(
    'name' => $this
      ->randomName(),
    'vid' => $term['vid'],
  );
  $this
    ->servicesPut($path . '/taxonomy_term/' . $term['tid'], $term_update_data);
  $term_update = (array) current(entity_load('taxonomy_term', array(
    $term['tid'],
  ), array(), TRUE));

  // Ensure that terms have different names but same tid.
  $this
    ->assertTrue($term['tid'] == $term_update['tid'] && $term['name'] != $term_update['name'], 'Taxonomy term updated properly.', 'TaxonomyTermResource: Update');
}