You are here

function TokenCurrentPageTestCase::testCurrentPageTokens in Token 6

Same name and namespace in other branches
  1. 7 token.test \TokenCurrentPageTestCase::testCurrentPageTokens()

File

./token.test, line 672
Tests for the token module.

Class

TokenCurrentPageTestCase
Test the current page tokens.

Code

function testCurrentPageTokens() {
  $tokens = array(
    '[current-page-title]' => '',
    '[current-page-path]' => 'node',
    '[current-page-url]' => url('node', array(
      'absolute' => TRUE,
    )),
    '[current-page-number]' => 1,
  );
  $this
    ->assertPageTokens('', $tokens);
  $node = $this
    ->drupalCreateNode(array(
    'title' => 'Node title',
    'path' => 'node-alias',
  ));
  $tokens = array(
    '[current-page-title]' => 'Node title',
    '[current-page-path]' => 'node-alias',
    '[current-page-url]' => url("node/{$node->nid}", array(
      'absolute' => TRUE,
    )),
    '[current-page-number]' => 1,
  );
  $this
    ->assertPageTokens("node/{$node->nid}", $tokens);
}