public function FeedsWebTestCase::addMappings in Feeds 6
Same name and namespace in other branches
- 7.2 tests/feeds.test \FeedsWebTestCase::addMappings()
- 7 tests/feeds.test.inc \FeedsWebTestCase::addMappings()
Add mappings to a given configuration.
Parameters
$mappings: An array of mapping arrays. Each mapping array must have a source and an target key and can have a unique key.
See also
FeedsRSStoDataTest class.
23 calls to FeedsWebTestCase::addMappings()
- FeedsCSVtoTermsTest::test in tests/
feeds_processor_term.test - Test node creation, refreshing/deleting feeds and feed items.
- FeedsCSVtoUsersTest::test in tests/
feeds_processor_user.test - Test node creation, refreshing/deleting feeds and feed items.
- FeedsMapperContentTaxonomyTestCase::test in tests/
feeds_mapper_content_taxonomy.test - Basic test loading a single entry CSV file.
- FeedsMapperContentTestCase::test in tests/
feeds_mapper_content.test - Basic test loading a doulbe entry CSV file.
- FeedsMapperDateTestCase::test in tests/
feeds_mapper_date.test - Basic test loading a single entry CSV file.
File
- tests/
feeds.test, line 323 - Common functionality for all Feeds tests.
Class
- FeedsWebTestCase
- Test basic Data API functionality.
Code
public function addMappings($id, $mappings) {
$path = 'admin/build/feeds/edit/' . $id . '/mapping';
// Iterate through all mappings and add the via the form.
foreach ($mappings as $i => $mapping) {
// Get unique flag and unset it - otherwise drupalPost will complain that
// there is no form element named "unique".
$unique = !empty($mapping['unique']);
unset($mapping['unique']);
$this
->drupalPost($path, $mapping, t('Add'));
// If unique was set, set the last mapping's unique flag.
if ($unique) {
$edit = array(
'unique_flags[' . $i . ']' => 1,
);
$this
->drupalPost($path, $edit, t('Save'));
}
}
}