public function FeedsMapperPathPathautoTestCase::test in Feeds 7.2
Basic for allowing pathauto to override the alias.
File
- tests/
feeds_mapper_path.test, line 190 - Contains FeedsMapperPathTestCase.
Class
- FeedsMapperPathPathautoTestCase
- Class for testing Feeds <em>path</em> mapper with pathauto.module.
Code
public function test() {
// Create importer configuration.
$this
->createImporterConfiguration($this
->randomName(), 'path_test');
$this
->setPlugin('path_test', 'FeedsFileFetcher');
$this
->setPlugin('path_test', 'FeedsCSVParser');
$this
->addMappings('path_test', array(
0 => array(
'source' => 'Title',
'target' => 'title',
'unique' => FALSE,
),
1 => array(
'source' => 'does_not_exist',
'target' => 'path_alias',
'pathauto_override' => TRUE,
),
2 => array(
'source' => 'GUID',
'target' => 'guid',
'unique' => TRUE,
),
));
// Turn on update existing.
$this
->setSettings('path_test', 'FeedsNodeProcessor', array(
'update_existing' => 2,
));
// Import RSS file.
$this
->importFile('path_test', $this
->absolutePath() . '/tests/feeds/path_alias.csv');
$this
->assertText('Created 9 nodes');
$aliases = array();
for ($i = 1; $i <= 9; $i++) {
$aliases[] = "content/pathauto{$i}";
}
$this
->assertAliasCount($aliases);
// Adding a mapping will force update.
$this
->addMappings('path_test', array(
3 => array(
'source' => 'fake',
'target' => 'body',
),
));
// Import RSS file.
$this
->importFile('path_test', $this
->absolutePath() . '/tests/feeds/path_alias.csv');
$this
->assertText('Updated 9 nodes');
// Check that duplicate aliases are not created.
$this
->assertAliasCount($aliases);
}