public function FeedsWebTestCase::addMappings in Feeds 7
Same name and namespace in other branches
- 6 tests/feeds.test \FeedsWebTestCase::addMappings()
- 7.2 tests/feeds.test \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.
18 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.
- 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.
- FeedsMapperEmfieldTestCase::test in tests/
feeds_mapper_emfield.test - Basic test loading a doulbe entry CSV file.
File
- tests/
feeds.test.inc, line 306 - Common functionality for all Feeds tests.
Class
- FeedsWebTestCase
- Test basic Data API functionality.
Code
public function addMappings($id, $mappings) {
$path = 'admin/structure/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'));
}
}
}