protected function FeedsJavascriptTestBase::mappingGetEditValues in Feeds 8.3
Returns edit values for the mappings page.
Parameters
array $mappings: An array of mapping arrays.
Return value
array A list of edit values.
3 calls to FeedsJavascriptTestBase::mappingGetEditValues()
- FeedsJavascriptTestBase::addMappings in tests/
src/ FunctionalJavascript/ FeedsJavascriptTestBase.php - Adds mappings to the given feed type via the UI.
- MappingFormTest::testCustomSourceUniqueForUnsavedMappings in tests/
src/ FunctionalJavascript/ Form/ MappingFormTest.php - Tests that custom source names are unique for unsaved mappings.
- MappingFormTest::testSetMultipleMappingsWithCustomSources in tests/
src/ FunctionalJavascript/ Form/ MappingFormTest.php - Tests that multiple new CSV sources can be defined without errors.
File
- tests/
src/ FunctionalJavascript/ FeedsJavascriptTestBase.php, line 151
Class
- FeedsJavascriptTestBase
- Base class for Feeds javascript tests.
Namespace
Drupal\Tests\feeds\FunctionalJavascriptCode
protected function mappingGetEditValues(array $mappings) {
$edit = [];
foreach ($mappings as $i => $mapping) {
// Select sources.
foreach ($mapping['map'] as $key => $source) {
if (is_array($source)) {
$edit["mappings[{$i}][map][{$key}][select]"] = '__new';
foreach ($source as $source_key => $source_value) {
$edit["mappings[{$i}][map][{$key}][__new][{$source_key}]"] = $source_value;
}
}
else {
// Existing or predefined source.
$edit["mappings[{$i}][map][{$key}][select]"] = $source;
}
}
// Set uniques, if specified.
if (isset($mapping['unique'])) {
foreach ($mapping['unique'] as $key => $enabled) {
$edit["mappings[{$i}][unique][{$key}]"] = $enabled;
}
}
}
return $edit;
}