public function test_delete_vocabulary() { // Set up // Create and insert a vocabulary $params = array( 'name' => $this->vocab_name, 'description' => $this->vocab_desc, 'features' => array( 'hierarchical' ) ); $v = new Vocabulary( $params ); $v->insert(); // Count the number of vocabularies before deletion $vocab_count = count( Vocabulary::names() ); // Retrieve and delete vocabulary $v = Vocabulary::get( $this->vocab_name ); try { $v->delete(); } catch ( Exception $e ) { echo 'Caught exception: ',$e->getMessage(), "\n"; } $this->assert_equal( $vocab_count - 1, count( Vocabulary::names() ), 'Number of vocabularies should decrease by one' ); $this->assert_false( in_array( $this->vocab_name, Vocabulary::names() ), 'Deleted vocabulary name should not be in list of vocabulary names' ); }