protected function FeedsTamperUIWebTestCase::addTamperPlugin in Feeds Tamper 7
Same name and namespace in other branches
- 8.2 legacy/feeds_tamper_ui/tests/feeds_tamper_ui.test \FeedsTamperUIWebTestCase::addTamperPlugin()
- 6 feeds_tamper_ui/tests/feeds_tamper_ui.test \FeedsTamperUIWebTestCase::addTamperPlugin()
Overrides FeedsTamperWebTestHelper::addTamperPlugin
1 call to FeedsTamperUIWebTestCase::addTamperPlugin()
- FeedsTamperUIWebTestCase::testBasic in feeds_tamper_ui/
tests/ feeds_tamper_ui.test
File
- feeds_tamper_ui/
tests/ feeds_tamper_ui.test, line 213 - Tests for feeds_tamper_ui.module.
Class
- FeedsTamperUIWebTestCase
- Test Feeds Tamper UI.
Code
protected function addTamperPlugin($importer_id, $source, $plugin_id, $settings = array(), $description = NULL, $id = NULL) {
$plugin = feeds_tamper_get_plugin($plugin_id);
$default_description = !empty($plugin['default description']) ? $plugin['default description'] : $plugin['name'];
$url = 'admin/structure/feeds/' . $importer_id . '/tamper/add/' . bin2hex($source);
$this
->drupalPost($url, array(
'plugin_id' => $plugin_id,
), t('Choose'));
// Check that default values were added to form.
$this
->assertFieldByName('description', $default_description);
// Set settings.
$edit = array(
'plugin_id' => $plugin_id,
);
if (!empty($description)) {
$edit['description'] = $description;
}
if (!empty($id)) {
$edit['id'] = $id;
}
$this
->drupalPost(NULL, $edit + $settings, 'Add');
$description = !empty($description) ? $description : $default_description;
$id = $importer_id . '-' . feeds_tamper_make_machine($source) . '-' . $plugin_id;
$instance = feeds_tamper_load_instance($id);
$source_name = feeds_tamper_ui_source_name($instance);
$this
->assertText('Plugin ' . $description . ' was successfully added to ' . $source_name . '.');
return $id;
}