function TaxonomyVocabularyTestCase::testTaxonomyVocabularyLoadStaticReset in Drupal 7
Ensure that the vocabulary static reset works correctly.
File
- modules/
taxonomy/ taxonomy.test, line 272 - Tests for taxonomy.module.
Class
- TaxonomyVocabularyTestCase
- Tests for taxonomy vocabulary functions.
Code
function testTaxonomyVocabularyLoadStaticReset() {
$original_vocabulary = taxonomy_vocabulary_load($this->vocabulary->vid);
$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->vid);
$this
->assertEqual($new_vocabulary->name, $vocabulary->name);
$this
->assertEqual($new_vocabulary->name, $vocabulary->name);
// Delete the vocabulary.
taxonomy_vocabulary_delete($this->vocabulary->vid);
$vocabularies = taxonomy_get_vocabularies();
$this
->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), 'The vocabulary was deleted.');
}