You are here

public function FeedsWebTestCase::removeMappings in Feeds 7.2

Remove mappings from a given configuration.

Parameters

string $id: ID of the importer.

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.

11 calls to FeedsWebTestCase::removeMappings()
FeedsCSVtoUsersTest::test in tests/feeds_processor_user.test
Test user creation, refreshing/deleting feeds and feed items.
FeedsCSVtoUsersTest::testMD5 in tests/feeds_processor_user.test
Test if users with md5 passwords can login after import.
FeedsCSVtoUsersTest::testSha512 in tests/feeds_processor_user.test
Test if users with sha512 passwords can login after import.
FeedsMapperNodeSummaryTestCase::test in tests/feeds_mapper_summary.test
Tests importing CSV files for text fields with summary.
FeedsMapperTaxonomyTestCase::testSearchByName in tests/feeds_mapper_taxonomy.test
Tests searching taxonomy terms by name.

... See full list

File

tests/feeds.test, line 582
Common functionality for all Feeds tests.

Class

FeedsWebTestCase
Test basic Data API functionality.

Code

public function removeMappings($id, array $mappings, $test_mappings = TRUE) {
  $path = "admin/structure/feeds/{$id}/mapping";
  $edit = array();

  // 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.');
    }
    $edit["remove_flags[{$i}]"] = 1;
  }
  $this
    ->drupalPost($path, $edit, t('Save'));
  $this
    ->assertText('Your changes have been saved.');
}