diff -urpN -x '*.DS_Store' tests/feeds/emfield.csv tests_new/feeds/emfield.csv --- tests/feeds/emfield.csv 1969-12-31 17:00:00.000000000 -0700 +++ tests_new/feeds/emfield.csv 2010-07-21 08:57:44.000000000 -0600 @@ -0,0 +1,6 @@ +"guid","title","created","video","body" +1,"Lorem ipsum",1251936720,"http://www.youtube.com/watch?v=gpkhANg919Y","Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." +2,"Ut wisi enim ad minim veniam",1251932360,"http://www.youtube.com/watch?v=ewAGXAeCXJY","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat." +"guid","title","created","video","body" +1,"Lorem ipsum",1251936720,"http://www.youtube.com/watch?v=gpkhANg919Y","Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." +2,"Ut wisi enim ad minim veniam",1251932360,"http://www.youtube.com/watch?v=ewAGXAeCXJY","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat." diff -urpN -x '*.DS_Store' tests/feeds_mapper_emfield.test tests_new/feeds_mapper_emfield.test --- tests/feeds_mapper_emfield.test 1969-12-31 17:00:00.000000000 -0700 +++ tests_new/feeds_mapper_emfield.test 2010-07-21 08:57:44.000000000 -0600 @@ -0,0 +1,182 @@ +emfield mapper. + */ +class FeedsMapperEmfieldTestCase extends FeedsMapperTestCase { + + public static function getInfo() { + return array( + 'name' => t('Mapper: Emfield'), + 'description' => t('Test Feeds Mapper support for Emfield CCK fields. Requires CCK module and Emfield module.'), + 'group' => t('Feeds'), + ); + } + + /** + * Set up the test. + */ + function setUp() { + // Call parent setup with required modules. + parent::setUp('feeds', 'feeds_ui', 'ctools', 'content', 'emfield', 'emvideo'); + + // Create user and login. + $this->drupalLogin($this->drupalCreateUser( + array( + 'administer content types', + 'administer feeds', + 'administer nodes', + 'administer site configuration' + ) + )); + } + + /** + * Basic test loading a double entry CSV file. + */ + function test() { + + // Create content type. + $typename = $this->createContentType(NULL, array( + 'video' => array( + 'type' => 'emvideo', + 'widget' => 'emvideo_textfields', + ), + )); + + // Create and configure importer. + $this->createFeedConfiguration('Emfield CSV', 'csv'); + $this->setSettings('csv', NULL, array('content_type' => '','import_period' => FEEDS_SCHEDULE_NEVER,)); + $this->setPlugin('csv', 'FeedsFileFetcher'); + $this->setPlugin('csv', 'FeedsCSVParser'); + $this->setSettings('csv', 'FeedsNodeProcessor', array('content_type' => $typename)); + $this->addMappings('csv', array( + array( + 'source' => 'title', + 'target' => 'title', + ), + array( + 'source' => 'created', + 'target' => 'created', + ), + array( + 'source' => 'body', + 'target' => 'body', + ), + array( + 'source' => 'video', + 'target' => 'field_video', + ), + )); + + // Import CSV file. + $this->importFile('csv', $this->absolutePath() .'/tests/feeds/emfield.csv'); + $this->assertText('Created 2 '. $typename .' nodes.'); + + // Check the two imported files. + $this->drupalGet('node/1/edit'); + $this->assertFieldByName('field_video[0][embed]', 'http://www.youtube.com/watch?v=gpkhANg919Y'); + + $this->drupalGet('node/2/edit'); + $this->assertFieldByName('field_video[0][embed]', 'http://www.youtube.com/watch?v=ewAGXAeCXJY'); + } +} +emfield mapper. + */ +class FeedsMapperEmfieldTestCase extends FeedsMapperTestCase { + + public static function getInfo() { + return array( + 'name' => t('Mapper: Emfield'), + 'description' => t('Test Feeds Mapper support for Emfield CCK fields. Requires CCK module and Emfield module.'), + 'group' => t('Feeds'), + ); + } + + /** + * Set up the test. + */ + function setUp() { + // Call parent setup with required modules. + parent::setUp('feeds', 'feeds_ui', 'ctools', 'content', 'emfield', 'emvideo'); + + // Create user and login. + $this->drupalLogin($this->drupalCreateUser( + array( + 'administer content types', + 'administer feeds', + 'administer nodes', + 'administer site configuration' + ) + )); + } + + /** + * Basic test loading a double entry CSV file. + */ + function test() { + + // Create content type. + $typename = $this->createContentType(NULL, array( + 'video' => array( + 'type' => 'emvideo', + 'widget' => 'emvideo_textfields', + ), + )); + + // Create and configure importer. + $this->createFeedConfiguration('Emfield CSV', 'csv'); + $this->setSettings('csv', NULL, array('content_type' => '','import_period' => FEEDS_SCHEDULE_NEVER,)); + $this->setPlugin('csv', 'FeedsFileFetcher'); + $this->setPlugin('csv', 'FeedsCSVParser'); + $this->setSettings('csv', 'FeedsNodeProcessor', array('content_type' => $typename)); + $this->addMappings('csv', array( + array( + 'source' => 'title', + 'target' => 'title', + ), + array( + 'source' => 'created', + 'target' => 'created', + ), + array( + 'source' => 'body', + 'target' => 'body', + ), + array( + 'source' => 'video', + 'target' => 'field_video', + ), + )); + + // Import CSV file. + $this->importFile('csv', $this->absolutePath() .'/tests/feeds/emfield.csv'); + $this->assertText('Created 2 '. $typename .' nodes.'); + + // Check the two imported files. + $this->drupalGet('node/1/edit'); + $this->assertFieldByName('field_video[0][embed]', 'http://www.youtube.com/watch?v=gpkhANg919Y'); + + $this->drupalGet('node/2/edit'); + $this->assertFieldByName('field_video[0][embed]', 'http://www.youtube.com/watch?v=ewAGXAeCXJY'); + } +}