1 taxonomy.test | TaxonomyVocabularyUnitTest::testTaxonomyVocabularyLoadStaticReset() |
Ensure that the vocabulary static reset works correctly.
File
- core/
modules/ taxonomy/ tests/ taxonomy.test, line 326 - Tests for taxonomy.module.
Class
- TaxonomyVocabularyUnitTest
- Tests for taxonomy vocabulary functions.
Code
function testTaxonomyVocabularyLoadStaticReset() {
$original_vocabulary = taxonomy_vocabulary_load($this->vocabulary->machine_name);
$this->assertTrue(is_object($original_vocabulary), 'Vocabulary loaded successfully.');
$this->assertEqual($this->vocabulary->name, $original_vocabulary->name, 'Vocabulary loaded successfully.');
// Change the name and description.
$vocabulary = $original_vocabulary;
$vocabulary->name = $this->randomName();
$vocabulary->description = $this->randomName();
taxonomy_vocabulary_save($vocabulary);
// Load the vocabulary.
$new_vocabulary = taxonomy_vocabulary_load($original_vocabulary->machine_name);
$this->assertEqual($new_vocabulary->name, $vocabulary->name);
$this->assertEqual($new_vocabulary->name, $vocabulary->name);
// Delete the vocabulary.
taxonomy_vocabulary_delete($this->vocabulary->machine_name);
$vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
$this->assertTrue(!isset($vocabularies[$this->vocabulary->machine_name]), 'The vocabulary was deleted.');
}