You are here

function PathautoUnitTestCase::testPathTokens in Pathauto 7

Test the handling of path vs non-path tokens in pathauto_clean_token_values().

File

./pathauto.test, line 298
Functionality tests for Pathauto.

Class

PathautoUnitTestCase
Unit tests for Pathauto functions.

Code

function testPathTokens() {
  variable_set('pathauto_taxonomy_term_pattern', '[term:parent:url:path]/[term:name]');
  $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' => $term1->tid,
  ));
  $this
    ->assertEntityAlias('taxonomy_term', $term2, 'parent-term/child-term');
  $this
    ->saveEntityAlias('taxonomy_term', $term1, 'My Crazy/Alias/');
  pathauto_taxonomy_term_update($term2);
  $this
    ->assertEntityAlias('taxonomy_term', $term2, 'My Crazy/Alias/child-term');
}