You are here

protected function FeedsParaMapperWebTestCase::addTamperPlugin in Feeds Paragraphs 7

Creates a Tamper plugin.

Parameters

string $importer: The importer name.

string $source: The source name.

string $plugin_id: The plugin to add.

string $description: The plugin description.

array $settings: Configuration for the plugin (e.g The separator field value).

Return value

string The plugin id.

1 call to FeedsParaMapperWebTestCase::addTamperPlugin()
FeedsParaMapperWebTestCase::addTamperPlugins in tests/FeedsParaMapperWebTestCase.test
Add the needed Tamper plugins (explode) in a loop.

File

tests/FeedsParaMapperWebTestCase.test, line 701
Common functionality for all Paragraphs Mapper tests.

Class

FeedsParaMapperWebTestCase
Test basic functionality via DrupalWebTestCase.

Code

protected function addTamperPlugin($importer, $source, $plugin_id, $description, array $settings = array()) {
  $url = "admin/structure/feeds/{$importer}/tamper/add/" . bin2hex($source);
  $edit = array(
    'plugin_id' => $plugin_id,
  );
  $this
    ->drupalPost($url, $edit, t('Choose'));
  $id = str_replace(' ', '_', $description);
  $id = strtolower($id);
  $edit = array(
    'plugin_id' => $plugin_id,
    'description' => $description,
    'id' => $id,
  );
  $edit = array_merge($edit, $settings);
  $this
    ->drupalPost(NULL, $edit, t("Add"));
  return $id;
}