function ServicesResourceTaxonomyTests::testVocabularyCreate in Services 6.3
Same name and namespace in other branches
- 7.3 tests/functional/ServicesResourceTaxonomyTests.test \ServicesResourceTaxonomyTests::testVocabularyCreate()
Test taxonomy vocabulary create method.
File
- tests/
functional/ ServicesResourceTaxonomyTests.test, line 54
Class
- ServicesResourceTaxonomyTests
- Run test cases for the endpoint with no authentication turned on.
Code
function testVocabularyCreate() {
$path = $this->endpoint->path;
$vocabulary = array(
'name' => $this
->randomName(),
'description' => $this
->randomString(),
'help' => $this
->randomString(),
'relations' => 1,
'hierarchy' => 1,
'multiple' => 1,
'required' => 0,
'module' => 'services',
'weight' => 0,
);
$response = $this
->servicesPost($path . '/taxonomy_vocabulary', $vocabulary);
$vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name = "%s"', $vocabulary['name']));
$vocabulary_load = (array) taxonomy_vocabulary_load($vid);
$vocabulary_intersect = array_intersect_assoc($vocabulary, $vocabulary_load);
$this
->assertEqual($vocabulary, $vocabulary_intersect, t('Taxonomy vocabulary created properly.'), 'TaxonomyVocabularyResource: Create');
}