You are here

function ServicesResourceTaxonomyTests::testTermUpdateLegacy in Services 7.3

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

Test taxonomy term update method (Legacy).

TODO: To be removed in future version.

See also

http://drupal.org/node/1083242

File

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

Class

ServicesResourceTaxonomyTests
Taxonomy resource test class.

Code

function testTermUpdateLegacy() {
  $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'], array(
    'term' => $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 (Legacy)');
}