protected function FeedsParaMapperWebTestCase::addImporter in Feeds Paragraphs 7
Creates a feed importer.
Parameters
string $name: The importer name.
string $content_type: The content type to attach to the importer.
1 call to FeedsParaMapperWebTestCase::addImporter()
- FeedsParaMapperWebTestCase::setUp in tests/
FeedsParaMapperWebTestCase.test - Prepares the test environment.
File
- tests/
FeedsParaMapperWebTestCase.test, line 268 - Common functionality for all Paragraphs Mapper tests.
Class
- FeedsParaMapperWebTestCase
- Test basic functionality via DrupalWebTestCase.
Code
protected function addImporter($name, $content_type) {
$this
->drupalGet('admin/structure/feeds/create');
$edit = array(
'name' => $name,
'id' => $name,
);
$this
->drupalPost(NULL, $edit, t('Create'));
$message = format_string("Created importer with the name @name", array(
'@name' => $name,
));
$text = t("Your configuration has been created with default settings.");
$this
->assertText($text, $message, "Setup");
// Change the fetcher to the File upload fetcher (FeedsFileFetcher).
$this
->drupalGet('admin/structure/feeds/' . $name . '/fetcher');
$edit = array(
'plugin_key' => 'FeedsFileFetcher',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$message = "Changed the fetcher to the file fetcher";
$text = t("Changed fetcher plugin.");
$this
->assertText($text, $message, "Setup");
// Change the parser to CSV parser (FeedsCSVParser).
$this
->drupalGet('admin/structure/feeds/' . $name . '/parser');
$edit = array(
'plugin_key' => 'FeedsCSVParser',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$message = "Changed the parser to the CSV Parser";
$text = t("Changed parser plugin.");
$this
->assertText($text, $message, "Setup");
// Make sure the node processor is selected.
$this
->drupalGet('admin/structure/feeds/' . $name . '/processor');
$edit = array(
'plugin_key' => 'FeedsNodeProcessor',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$message = "Changed the processor to Node Processor";
$text = t("Changed processor plugin.");
$this
->assertText($text, $message, "Setup");
// Change the bundle to the $content_type.
$this
->drupalGet('admin/structure/feeds/' . $name . '/settings/FeedsNodeProcessor');
$edit = array(
'bundle' => $content_type,
'update_existing' => '2',
'skip_hash_check' => '1',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$message = format_string("Selected @type content type as bundle for this importer", array(
'@type' => $content_type,
));
$text = t("Your changes have been saved.");
$this
->assertText($text, $message, "Setup");
}