function FeedsMapperTaxonomyTestCase::testInheritTaxonomy in Feeds 6
Same name and namespace in other branches
- 7.2 tests/feeds_mapper_taxonomy.test \FeedsMapperTaxonomyTestCase::testInheritTaxonomy()
- 7 tests/feeds_mapper_taxonomy.test \FeedsMapperTaxonomyTestCase::testInheritTaxonomy()
Test inheriting taxonomy from the feed node.
File
- tests/
feeds_mapper_taxonomy.test, line 69 - Test case for taxonomy mapper mappers/taxonomy.inc.
Class
- FeedsMapperTaxonomyTestCase
- Class for testing Feeds <em>content</em> mapper.
Code
function testInheritTaxonomy() {
// Map feed node's taxonomy to feed item node's taxonomy.
$this
->addMappings('syndication', array(
array(
'source' => 'parent:taxonomy:1',
'target' => 'taxonomy:1',
),
));
// Turn off import on create, create feed node, tag, import.
$edit = array(
'import_on_create' => FALSE,
);
$this
->drupalPost('admin/build/feeds/edit/syndication/settings', $edit, 'Save');
$this
->assertText('Do not import on create');
$nid = $this
->createFeedNode();
$terms = array(
'testterm1',
'testterm2',
'testterm3',
);
$edit = array(
'taxonomy[tags][1]' => implode(',', $terms),
);
$this
->drupalPost("node/{$nid}/edit", $edit, t('Save'));
$this
->drupalPost('node/' . $nid . '/import', array(), 'Import');
$count = db_result(db_query("SELECT COUNT(*) FROM {term_node}", $nid));
$this
->assertEqual(33, $count, 'Found correct number of tags for all feed nodes and feed items.');
foreach ($terms as $term) {
$this
->assertTaxonomyTerm($term);
}
}