示例#1
0
 public function test_rename_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();
     // Rename vocabulary
     $vocab_count = count(Vocabulary::names());
     Vocabulary::rename($this->vocab_name, $this->vocab_rename);
     $this->assertTrue(in_array($this->vocab_rename, Vocabulary::names()), 'New vocabulary name should be in list of vocabulary names');
     $this->assertFalse(in_array($this->vocab_name, Vocabulary::names()), 'Old vocabulary name should not be in list of vocabulary names');
     $this->assertEquals($vocab_count, count(Vocabulary::names()), 'Number of vocabularies should not change on rename');
     // Clean up
     // Delete the vocabulary
     try {
         $v->delete();
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
 }