You are here

public function FeedsWebTestBase::mappingExists in Feeds 8.2

Determines if a mapping exists for a given importer.

Parameters

string $id: ID of the importer.

integer $i: The key of the mapping.

string $source: The source field.

string $target: The target field.

Return value

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

2 calls to FeedsWebTestBase::mappingExists()
FeedsWebTestBase::addMappings in lib/Drupal/feeds/Tests/FeedsWebTestBase.php
Adds mappings to a given configuration.
FeedsWebTestBase::removeMappings in lib/Drupal/feeds/Tests/FeedsWebTestBase.php
Remove mappings from a given configuration.

File

lib/Drupal/feeds/Tests/FeedsWebTestBase.php, line 510
Common functionality for all Feeds tests.

Class

FeedsWebTestBase
Test basic Data API functionality.

Namespace

Drupal\feeds\Tests

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;
}