You are here

public function FeedsWebTestCase::getCurrentMappings in Feeds 7.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.

7 calls to FeedsWebTestCase::getCurrentMappings()
FeedsRSStoNodesTest::testClearInBackground in tests/feeds_processor_node.test
Tests clearing items in background.
FeedsRSStoNodesTest::testImportInBackground in tests/feeds_processor_node.test
Tests process in background option.
FeedsRSStoNodesTest::testIrrelevantUpdate in tests/feeds_processor_node.test
Tests if target item is not updated when only non-mapped data on the source changed.
FeedsRSStoNodesTest::testPushImportWithCSV in tests/feeds_processor_node.test
Tests the FeedsSource::pushImport() method with a CSV file.
FeedsRSStoNodesTest::testSkipNewItems in tests/feeds_processor_node.test
Tests skip new items.

... See full list

File

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

Class

FeedsWebTestCase
Test basic Data API functionality.

Code

public function getCurrentMappings($id) {
  $config = db_query("SELECT config FROM {feeds_importer} WHERE id = :id", array(
    ':id' => $id,
  ))
    ->fetchField();
  $config = unserialize($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;
}