function PathautoUnitTestCase::testEntityBundleRenamingDeleting in Pathauto 7
Same name and namespace in other branches
- 6.2 pathauto.test \PathautoUnitTestCase::testEntityBundleRenamingDeleting()
- 6 pathauto.test \PathautoUnitTestCase::testEntityBundleRenamingDeleting()
File
- ./
pathauto.test, line 347 - Functionality tests for Pathauto.
Class
- PathautoUnitTestCase
- Unit tests for Pathauto functions.
Code
function testEntityBundleRenamingDeleting() {
// Create a vocabulary and test that it's pattern variable works.
$vocab = $this
->addVocabulary(array(
'machine_name' => 'old_name',
));
variable_set('pathauto_taxonomy_term_pattern', 'base');
variable_set("pathauto_taxonomy_term_old_name_pattern", 'bundle');
$this
->assertEntityPattern('taxonomy_term', 'old_name', LANGUAGE_NONE, 'bundle');
// Rename the vocabulary's machine name, which should cause its pattern
// variable to also be renamed.
$vocab->machine_name = 'new_name';
taxonomy_vocabulary_save($vocab);
$this
->assertEntityPattern('taxonomy_term', 'new_name', LANGUAGE_NONE, 'bundle');
$this
->assertEntityPattern('taxonomy_term', 'old_name', LANGUAGE_NONE, 'base');
// Delete the vocabulary, which should cause its pattern variable to also
// be deleted.
taxonomy_vocabulary_delete($vocab->vid);
$this
->assertEntityPattern('taxonomy_term', 'new_name', LANGUAGE_NONE, 'base');
}