You are here

public function FeedsWebTestCase::mappingExists in Feeds 7.2

Determines if a mapping exists for a given importer.

Parameters

string $id: ID of the importer.

int $i: The key of the mapping.

string $source: The source field.

string $target: The target field.

Return value

int -1 if the mapping doesn't exist, the key of the mapping otherwise.

2 calls to FeedsWebTestCase::mappingExists()
FeedsWebTestCase::addMappings in tests/feeds.test
Adds mappings to a given configuration.
FeedsWebTestCase::removeMappings in tests/feeds.test
Remove mappings from a given configuration.

File

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

Class

FeedsWebTestCase
Test basic Data API functionality.

Code

public function mappingExists($id, $i, $source, $target) {
  $current_mappings = $this
    ->getCurrentMappings($id);
  if ($current_mappings) {
    foreach ($current_mappings as $key => $mapping) {
      if ($mapping['source'] == $source && $mapping['target'] == $target && $key == $i) {
        return $key;
      }
    }
  }
  return -1;
}