You are here

function ServicesResourceTaxonomyTests::testTermUpdateLegacy in Services 6.3

Same name and namespace in other branches
  1. 7.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 342

Class

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

Code

function testTermUpdateLegacy() {
  $path = $this->endpoint->path;
  $vocabulary = $this
    ->createVocabulary();
  $term = $this
    ->createTerm($vocabulary['vid']);
  $term_update_data = array(
    'name' => $this
      ->randomName(),
    'description' => $this
      ->randomString(),
    'weight' => rand(0, 100),
  );
  $this
    ->servicesPut($path . '/taxonomy_term/' . $term['tid'], array(
    'term' => $term_update_data,
  ));
  $term_update = (array) current(taxonomy_get_term_by_name($term_update_data['name']));

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