public function FeedsWebTestBase::removeMappings in Feeds 8.2
Remove mappings from a given configuration.
Parameters
array $mappings: An array of mapping arrays. Each mapping array must have a source and a target key and can have a unique key.
bool $test_mappings: (optional) TRUE to automatically test mapping configs. Defaults to TRUE.
2 calls to FeedsWebTestBase::removeMappings()
- FeedsCSVtoUsersTest::test in lib/
Drupal/ feeds/ Tests/ FeedsCSVtoUsersTest.php - Test node creation, refreshing/deleting feeds and feed items.
- FeedsMapperTaxonomyTest::testSearchByName in lib/
Drupal/ feeds/ Tests/ FeedsMapperTaxonomyTest.php - Tests searching taxonomy terms by name.
File
- lib/
Drupal/ feeds/ Tests/ FeedsWebTestBase.php, line 446 - Common functionality for all Feeds tests.
Class
- FeedsWebTestBase
- Test basic Data API functionality.
Namespace
Drupal\feeds\TestsCode
public function removeMappings($id, $mappings, $test_mappings = TRUE) {
$path = "admin/structure/feeds/{$id}/mapping";
$current_mappings = $this
->getCurrentMappings($id);
// Iterate through all mappings and remove via the form.
foreach ($mappings as $i => $mapping) {
if ($test_mappings) {
$current_mapping_key = $this
->mappingExists($id, $i, $mapping['source'], $mapping['target']);
$this
->assertEqual($current_mapping_key, $i, 'Mapping exists before removal.');
}
$remove_mapping = array(
"remove_flags[{$i}]" => 1,
);
$this
->drupalPost($path, $remove_mapping, t('Save'));
$this
->assertText('Your changes have been saved.');
if ($test_mappings) {
$current_mapping_key = $this
->mappingExists($id, $i, $mapping['source'], $mapping['target']);
$this
->assertEqual($current_mapping_key, -1, 'Mapping does not exist after removal.');
}
}
}