FeedsSourceTest.test in Feeds 7.2
File
tests/FeedsSourceTest.test
View source
<?php
class FeedsSourceTest extends FeedsWebTestCase {
public static function getInfo() {
return array(
'name' => 'FeedsSource class test',
'description' => 'Covers class FeedsSource.',
'group' => 'Feeds',
);
}
public function testProgrammaticImport() {
$this
->createImporterConfiguration('Content CSV', 'csv');
$this
->setSettings('csv', NULL, array(
'content_type' => '',
'import_period' => FEEDS_SCHEDULE_NEVER,
));
$this
->setPlugin('csv', 'FeedsCSVParser');
$this
->addMappings('csv', array(
0 => array(
'source' => 'guid',
'target' => 'guid',
'unique' => TRUE,
),
1 => array(
'source' => 'title',
'target' => 'title',
),
));
$source = feeds_source('csv');
$source
->save();
$source
->addConfig(array(
'FeedsHTTPFetcher' => array(
'source' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/content.csv',
),
));
while (FEEDS_BATCH_COMPLETE != $source
->import()) {
}
$this
->assertNodeCount(2);
$source
->addConfig(array(
'FeedsHTTPFetcher' => array(
'source' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/many_nodes_ordered.csv',
),
));
while (FEEDS_BATCH_COMPLETE != $source
->import()) {
}
$this
->assertNodeCount(86);
}
}