1 path_pattern.test | PathPatternUnitTestCase::testPathTokens() |
Test the handling of path vs non-path tokens in path_clean_token_values().
File
- core/
modules/ path/ tests/ path_pattern.test, line 343 - Functionality tests for automatic path generation.
Class
- PathPatternUnitTestCase
- Unit tests for Path pattern functions.
Code
function testPathTokens() {
$config = config('path.settings');
$config->set('taxonomy_term_pattern', '[term:parent:url:path]/[term:name]');
$config->save();
$vocab = $this->addVocabulary();
$term1 = $this->addTerm($vocab, array('name' => 'Parent term'));
$this->assertEntityAlias('taxonomy_term', $term1, 'parent-term');
$term2 = $this->addTerm($vocab, array('name' => 'Child term', 'parent' => array($term1->tid)));
$this->assertEntityAlias('taxonomy_term', $term2, 'parent-term/child-term');
$this->saveEntityAlias('taxonomy_term', $term1, 'My Crazy/Alias/');
$term2->save();
$this->assertEntityAlias('taxonomy_term', $term2, 'My Crazy/Alias/child-term');
}