function ServicesResourceTaxonomyTests::testVocabularyCreateLegacy in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesResourceTaxonomyTests.test \ServicesResourceTaxonomyTests::testVocabularyCreateLegacy()
Test taxonomy vocabulary create method (Legacy).
TODO: To be removed in future version.
See also
http://drupal.org/node/1083242
File
- tests/
functional/ ServicesResourceTaxonomyTests.test, line 172 - Call the endpoint tests when no authentication is being used.
Class
- ServicesResourceTaxonomyTests
- Taxonomy resource test class.
Code
function testVocabularyCreateLegacy() {
$path = $this->endpoint->path;
$vocabulary = array(
'name' => $this
->randomName(),
'machine_name' => $this
->randomName(),
'description' => $this
->randomString(),
'hierarchy' => 1,
'module' => 'services',
'weight' => 0,
);
$response = $this
->servicesPost($path . '/taxonomy_vocabulary', array(
'vocabulary' => $vocabulary,
));
$query = db_select('taxonomy_vocabulary', 'v')
->fields('v', array(
'vid',
))
->condition('v.name', $vocabulary['name']);
$vid = $query
->execute()
->fetchField();
$vocabulary_load = (array) taxonomy_vocabulary_load($vid);
$vocabulary_intersect = array_intersect_assoc($vocabulary, $vocabulary_load);
$this
->assertEqual($vocabulary, $vocabulary_intersect, 'Taxonomy vocabulary created properly.', 'TaxonomyVocabularyResource: Create (Legacy)');
}