function TokenNodeTestCase::testNodeTokens in Token 6
Same name and namespace in other branches
- 7 token.test \TokenNodeTestCase::testNodeTokens()
File
- ./
token.test, line 277 - Tests for the token module.
Class
Code
function testNodeTokens() {
$time = time();
$created = gmmktime(0, 0, 0, 11, 19, 1978);
$changed = gmmktime(0, 0, 0, 7, 4, 1984);
$node = $this
->drupalCreateNode(array(
'type' => 'page',
'language' => 'und',
'created' => $created,
'log' => '<blink>' . $this
->randomName() . '</blink>',
));
$node->changed = $changed;
path_set_alias('node/' . $node->nid, 'content/first-node');
$tokens = array(
'nid' => $node->nid,
'type' => 'page',
'type-name' => 'Page',
'language' => 'und',
'node-path' => 'content/first-node',
'node-url' => url('node/' . $node->nid, array(
'absolute' => TRUE,
)),
'small' => '11/19/1978 - 00:00',
'yyyy' => '1978',
'yy' => '78',
'month' => 'November',
'mon' => 'Nov',
'mm' => '11',
'm' => '11',
'ww' => '46',
'date' => '7',
'day' => 'Sunday',
'ddd' => 'Sun',
'dd' => '19',
'd' => '19',
'raw' => 280281600,
'since' => format_interval($time - 280281600),
'mod-small' => '07/04/1984 - 00:00',
'mod-yyyy' => '1984',
'mod-yy' => '84',
'mod-month' => 'July',
'mod-mon' => 'Jul',
'mod-mm' => '07',
'mod-m' => '7',
'mod-ww' => '27',
'mod-date' => '3',
'mod-day' => 'Wednesday',
'mod-ddd' => 'Wed',
'mod-dd' => '04',
'mod-d' => '4',
'mod-raw' => 457747200,
'mod-since' => format_interval($time - 457747200),
'log' => filter_xss($node->log),
'log-raw' => $node->log,
);
$this
->assertTokens('node', $node, $tokens);
// Check that a new revision of a node returns different tokens.
$node->revision = TRUE;
$node->title = 'New revision';
node_save($node);
$this
->assertTokens('node', $node, array(
'title' => 'New revision',
));
}