protected function FeedCreationTrait::createFeedType in Feeds 8.3
Creates a feed type with default settings.
Parameters
array $settings: (optional) An associative array of settings for the feed type entity. The following defaults are provided:
- label: Random string.
- ID: Random string.
- import_period: never.
- processor_configuration: authorize off and article bundle.
- mappings: mapping to guid and title.
Return value
\Drupal\feeds\FeedTypeInterface The created feed type entity.
51 calls to FeedCreationTrait::createFeedType()
- BasicFieldSourceTest::testImportWithTaxonomyTermReferenceSource in tests/
src/ Kernel/ Feeds/ Source/ BasicFieldSourceTest.php - Tests importing using a taxonomy term reference source.
- BasicFieldSourceTest::testImportWithTextfieldSource in tests/
src/ Kernel/ Feeds/ Source/ BasicFieldSourceTest.php - Tests importing using a text field source.
- CronTest::test in tests/
src/ Functional/ CronTest.php - Tests importing through cron.
- CronTest::testDeleteFeedTypeForWhichImportIsScheduled in tests/
src/ Functional/ CronTest.php - Tests that a cron run does not fail after deleting a feed type.
- DeleteFeedTest::test in tests/
src/ Functional/ Plugin/ Action/ DeleteFeedTest.php - Tests applying action "feeds_feed_delete_action" on feed entities.
File
- tests/
src/ Traits/ FeedCreationTrait.php, line 32
Class
- FeedCreationTrait
- Provides methods to create feeds and feed types with default settings.
Namespace
Drupal\Tests\feeds\TraitsCode
protected function createFeedType(array $settings = []) {
// Populate default array.
$settings += [
'id' => mb_strtolower($this
->randomMachineName()),
'label' => $this
->randomMachineName(),
'import_period' => FeedTypeInterface::SCHEDULE_NEVER,
'processor_configuration' => [
'authorize' => FALSE,
'values' => [
'type' => 'article',
],
],
'mappings' => $this
->getDefaultMappings(),
];
$feed_type = FeedType::create($settings);
$feed_type
->save();
return $feed_type;
}