public function PathautoKernelTest::testPathTokens in Pathauto 8
Test the handling of path vs non-path tokens in pathauto_clean_token_values().
File
- tests/
src/ Kernel/ PathautoKernelTest.php, line 355
Class
- PathautoKernelTest
- Unit tests for Pathauto functions.
Namespace
Drupal\Tests\pathauto\KernelCode
public function testPathTokens() {
$this
->createPattern('taxonomy_term', '/[term:parent:url:path]/[term:name]');
$vocab = $this
->addVocabulary();
$term1 = $this
->addTerm($vocab, [
'name' => 'Parent term',
]);
$this
->assertEntityAlias($term1, '/parent-term');
$term2 = $this
->addTerm($vocab, [
'name' => 'Child term',
'parent' => $term1
->id(),
]);
$this
->assertEntityAlias($term2, '/parent-term/child-term');
$this
->saveEntityAlias($term1, '/My Crazy/Alias/');
$term2
->save();
$this
->assertEntityAlias($term2, '/My Crazy/Alias/child-term');
}