*************** class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase { *** 65,102 **** * Test inheriting taxonomy from the feed node. */ 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/structure/feeds/syndication/settings', $edit, 'Save'); - $this->assertText('Do not import on submission'); - $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_query("SELECT COUNT(*) FROM {term_node}")->fetchField(); - $this->assertEqual(33, $count, 'Found correct number of tags for all feed nodes and feed items.'); - foreach ($terms as $term) { - $this->assertTaxonomyTerm($term); - } } /** * Test aggregating RSS categories to taxonomy. */ function testRSSCategoriesToTaxonomy() { // Add mapping to tags vocabulary. $this->addMappings('syndication', --- 118,165 ---- * Test inheriting taxonomy from the feed node. */ function testInheritTaxonomy() { + + // Adjust importer settings + $this->setSettings('syndication', NULL, array('import_period' => FEEDS_SCHEDULE_NEVER)); + $this->setSettings('syndication', NULL, array('import_on_create' => FALSE)); + $this->assertText('Do not import on submission'); + // Map feed node's taxonomy to feed item node's taxonomy. $this->addMappings('syndication', array( array( + 'source' => 'parent:taxonomy:tags', + 'target' => 'field_tags', + 'unique' => FALSE, ), ) ); + + // Create feed node and add term term1. + $langcode = LANGUAGE_NONE; + $nid = $this->createFeedNode('syndication', NULL, 'Syndication'); + $term = taxonomy_get_term_by_name('term1'); + $term = reset($term); $edit = array( + 'field_tags' . '[' . $langcode . '][]' => $term->tid, ); $this->drupalPost("node/$nid/edit", $edit, t('Save')); + $this->assertTaxonomyTerm($term->name); + + // Import nodes. $this->drupalPost("node/$nid/import", array(), 'Import'); + $this->assertText('Created 10 nodes.'); + + $count = db_query("SELECT COUNT(*) FROM {taxonomy_index}")->fetchField(); + + // There should be one term for each node imported plus the term on the feed node. + $this->assertEqual(11, $count, 'Found correct number of tags for all feed nodes and feed items.'); } /** * Test aggregating RSS categories to taxonomy. */ + /* function testRSSCategoriesToTaxonomy() { // Add mapping to tags vocabulary. $this->addMappings('syndication',