You are here

public function FeedsWebTestBase::getCurrentMappings in Feeds 8.2

Gets an array of current mappings from the feeds_importer config.

Parameters

string $id: ID of the importer.

Return value

bool|array FALSE if the importer has no mappings, or an an array of mappings.

2 calls to FeedsWebTestBase::getCurrentMappings()
FeedsWebTestBase::mappingExists in lib/Drupal/feeds/Tests/FeedsWebTestBase.php
Determines if a mapping exists for a given importer.
FeedsWebTestBase::removeMappings in lib/Drupal/feeds/Tests/FeedsWebTestBase.php
Remove mappings from a given configuration.

File

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

Class

FeedsWebTestBase
Test basic Data API functionality.

Namespace

Drupal\feeds\Tests

Code

public function getCurrentMappings($id) {
  $config = config('feeds.importer.' . $id)
    ->get('config');

  // We are very specific here. 'mappings' can either be an array or not
  // exist.
  if (array_key_exists('mappings', $config['processor']['config'])) {
    $this
      ->assertTrue(is_array($config['processor']['config']['mappings']), 'Mappings is an array.');
    return $config['processor']['config']['mappings'];
  }
  return FALSE;
}