function ServicesResourceTaxonomyTests::testTermCreate in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesResourceTaxonomyTests.test \ServicesResourceTaxonomyTests::testTermCreate()
Test taxonomy term create method.
File
- tests/
functional/ ServicesResourceTaxonomyTests.test, line 360 - Call the endpoint tests when no authentication is being used.
Class
- ServicesResourceTaxonomyTests
- Taxonomy resource test class.
Code
function testTermCreate() {
$path = $this->endpoint->path;
$vocabulary = $this
->createVocabulary();
$term = array(
'vid' => $vocabulary['vid'],
'name' => $this
->randomName(),
'description' => $this
->randomString(),
'weight' => rand(0, 100),
'parent' => NULL,
);
$response = $this
->servicesPost($path . '/taxonomy_term', $term);
// Load term by name.
$term_by_name = (array) current(taxonomy_get_term_by_name($term['name']));
$term_intersect = array_intersect_assoc($term, $term_by_name);
// As term_intersect will not have parent, we unset this property.
$term_data = $term;
unset($term_data['parent']);
$this
->assertEqual($term_data, $term_intersect, 'Taxonomy term created properly.', 'TaxonomyTermResource: Create');
}