function ServicesResourceTaxonomyTests::testTermUpdate in Services 6.3
Same name and namespace in other branches
- 7.3 tests/functional/ServicesResourceTaxonomyTests.test \ServicesResourceTaxonomyTests::testTermUpdate()
Test taxonomy term update method.
File
- tests/
functional/ ServicesResourceTaxonomyTests.test, line 316
Class
- ServicesResourceTaxonomyTests
- Run test cases for the endpoint with no authentication turned on.
Code
function testTermUpdate() {
$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'], $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');
}