function TaxonomyTermFunctionTestCase::testTermDelete

File

modules/taxonomy/taxonomy.test, line 422

Class

TaxonomyTermFunctionTestCase
Unit tests for taxonomy term functions.

Code

function testTermDelete() {
    $vocabulary = $this->createVocabulary();
    $valid_term = $this->createTerm($vocabulary);
    // Delete a valid term.
    taxonomy_term_delete($valid_term->tid);
    $terms = taxonomy_term_load_multiple(array(), array(
        'vid' => $vocabulary->vid,
    ));
    $this->assertTrue(empty($terms), 'Vocabulary is empty after deletion.');
    // Delete an invalid term. Should not throw any notices.
    taxonomy_term_delete(42);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.