t('FeedAPI Mapper Taxonomy'), 'description' => t('Test FeedAPI Mapper support for Taxonomy'), 'group' => t('FeedAPI Mapper'), ); } /** * SimpleTest core method: code run before each and every test method. */ function setUp() { // Always call the setUp() function from the parent class. @parent::setUp( 'feedapi', 'feedapi_node', 'parser_simplepie', 'parser_common_syndication', 'feedapi_mapper', 'content', 'taxonomy', 'ctools' ); // Create users. $this->admin_user = $this->drupalCreateUser( array( 'administer content types', 'administer feedapi', 'administer nodes', 'administer site configuration', 'administer taxonomy', 'advanced feedapi options', 'create feed content', ) ); } function testTaxonomyMapping() { $options = array( 'fields' => array( ), 'taxonomy' => array( 'freetags' => array('tags' => TRUE), ), 'filename' => 'drupal.xml', 'mappers' => array('node'), 'mapping' => array( serialize(array('options', 'tags')) => serialize(array('taxonomy', 'taxonomy', 'freetags')), ), ); $this->drupalLogin($this->admin_user); $this->enableParsers(TRUE, FALSE); $feed_url = $this->setupFeed($options); // Check that a bunch of terms were created $voc = $options['taxonomy']['freetags']['vocabulary']; $this->drupalGet('admin/content/taxonomy/' . $voc->vid); $links = $this->xpath('//table[@id="taxonomy"]/tbody/tr/td/a'); $this->assertEqual(18, count($links), 'Found 9 taxonomy terms + edit links'); // Check one of the nodes $this->drupalGet('admin/content/node/overview'); $this->clickLink('How we will make Drupal 7 simple to use'); $this->assertLink('Drupal 7.x'); $this->assertLink('Drupal News'); $this->assertLink('News and announcements'); $this->deleteFeed($feed_url); $this->drupalLogout(); } }