function TokenTaxonomyTestCase::testTaxonomyTokens in Token 7
Same name and namespace in other branches
- 6 token.test \TokenTaxonomyTestCase::testTaxonomyTokens()
Test the additional taxonomy term tokens.
File
- ./
token.test, line 496 - Test integration for the token module.
Class
Code
function testTaxonomyTokens() {
$root_term = $this
->addTerm($this->vocab, array(
'name' => 'Root term',
'path' => array(
'alias' => 'root-term',
),
));
$tokens = array(
'url' => url("taxonomy/term/{$root_term->tid}", array(
'absolute' => TRUE,
)),
'url:absolute' => url("taxonomy/term/{$root_term->tid}", array(
'absolute' => TRUE,
)),
'url:relative' => url("taxonomy/term/{$root_term->tid}", array(
'absolute' => FALSE,
)),
'url:path' => 'root-term',
'url:unaliased:path' => "taxonomy/term/{$root_term->tid}",
'edit-url' => url("taxonomy/term/{$root_term->tid}/edit", array(
'absolute' => TRUE,
)),
'parents' => NULL,
'parents:count' => NULL,
'parents:keys' => NULL,
'root' => NULL,
// Deprecated tokens
'url:alias' => 'root-term',
);
$this
->assertTokens('term', array(
'term' => $root_term,
), $tokens);
$parent_term = $this
->addTerm($this->vocab, array(
'name' => 'Parent term',
'parent' => $root_term->tid,
));
$tokens = array(
'url' => url("taxonomy/term/{$parent_term->tid}", array(
'absolute' => TRUE,
)),
'url:absolute' => url("taxonomy/term/{$parent_term->tid}", array(
'absolute' => TRUE,
)),
'url:relative' => url("taxonomy/term/{$parent_term->tid}", array(
'absolute' => FALSE,
)),
'url:path' => "taxonomy/term/{$parent_term->tid}",
'url:unaliased:path' => "taxonomy/term/{$parent_term->tid}",
'edit-url' => url("taxonomy/term/{$parent_term->tid}/edit", array(
'absolute' => TRUE,
)),
'parents' => 'Root term',
'parents:count' => 1,
'parents:keys' => $root_term->tid,
'root' => check_plain($root_term->name),
'root:tid' => $root_term->tid,
// Deprecated tokens
'url:alias' => "taxonomy/term/{$parent_term->tid}",
);
$this
->assertTokens('term', array(
'term' => $parent_term,
), $tokens);
$term = $this
->addTerm($this->vocab, array(
'name' => 'Test term',
'parent' => $parent_term->tid,
));
$tokens = array(
'parents' => 'Root term, Parent term',
'parents:count' => 2,
'parents:keys' => implode(', ', array(
$root_term->tid,
$parent_term->tid,
)),
);
$this
->assertTokens('term', array(
'term' => $term,
), $tokens);
}