public function FeedsCSVtoRelationsTest::importUsers in Relation 7
Import users from feeds CSV to get some data available for endpoints.
1 call to FeedsCSVtoRelationsTest::importUsers()
- FeedsCSVtoRelationsTest::setUp in relation_feeds/
tests/ relation.feeds_processor.test
File
- relation_feeds/
tests/ relation.feeds_processor.test, line 50
Class
- FeedsCSVtoRelationsTest
- Test aggregating a feed as data records.
Code
public function importUsers() {
$this
->createImporterConfiguration('User import', 'user_import');
// Set and configure plugins.
$this
->setPlugin('user_import', 'FeedsFileFetcher');
$this
->setPlugin('user_import', 'FeedsCSVParser');
$this
->setPlugin('user_import', 'FeedsUserProcessor');
// Go to mapping page and create a couple of mappings.
$mappings = array(
0 => array(
'source' => 'name',
'target' => 'guid',
'unique' => TRUE,
),
1 => array(
'source' => 'name',
'target' => 'name',
'unique' => TRUE,
),
2 => array(
'source' => 'mail',
'target' => 'mail',
'unique' => FALSE,
),
);
$this
->addMappings('user_import', $mappings);
// Import CSV file.
$path = $this
->absolute() . '/' . drupal_get_path('module', 'feeds');
$this
->importFile('user_import', $path . '/tests/feeds/users.csv');
}