function PathautoUnitTestCase::testFeedAliases in Pathauto 6
Test the feed alias functionality of pathauto_create_alias().
File
- ./
pathauto.test, line 262 - Functionality tests for Pathauto.
Class
- PathautoUnitTestCase
- Unit tests for Pathauto functions.
Code
function testFeedAliases() {
variable_set('pathauto_node_pattern', '[title-raw]');
variable_set('pathauto_node_applytofeeds', '');
// Create a node with an empty title, which should not create an alias.
$node = $this
->drupalCreateNode(array(
'title' => '',
));
$this
->assertNoAliasExists(array(
'source' => "node/{$node->nid}",
));
$this
->assertNoAliasExists(array(
'source' => "node/{$node->nid}/feed",
));
// Add a title to the node. This should still not generate a feed alias.
$node->title = 'Node title';
pathauto_nodeapi($node, 'update');
$this
->assertAliasExists(array(
'source' => "node/{$node->nid}",
'alias' => 'node-title',
));
$this
->assertNoAliasExists(array(
'source' => "node/{$node->nid}/feed",
));
// Enable feeds for nodes. A feed alias should now be generated.
variable_set('pathauto_node_applytofeeds', ' feed ');
pathauto_nodeapi($node, 'update');
$this
->assertAliasExists(array(
'source' => "node/{$node->nid}/feed",
'alias' => 'node-title/feed',
));
}