You are here

protected function FeedCreationTrait::createFeed in Feeds 8.3

Creates a feed with default settings.

Parameters

string $feed_type_id: The feed type ID.

array $settings: (optional) An associative array of settings for the feed entity. The following defaults are provided:

  • title: Random string.

Return value

\Drupal\feeds\FeedInterface The created feed entity.

137 calls to FeedCreationTrait::createFeed()
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.
ConfigEntityReferenceTest::testImportById in tests/src/Kernel/Feeds/Target/ConfigEntityReferenceTest.php
Tests importing config entity references by ID.
ConfigEntityReferenceTest::testImportByLabel in tests/src/Kernel/Feeds/Target/ConfigEntityReferenceTest.php
Tests importing config entity references by label.
ConfigEntityReferenceTest::testImportByUuid in tests/src/Kernel/Feeds/Target/ConfigEntityReferenceTest.php
Tests importing config entity references by UUID.

... See full list

File

tests/src/Traits/FeedCreationTrait.php, line 138

Class

FeedCreationTrait
Provides methods to create feeds and feed types with default settings.

Namespace

Drupal\Tests\feeds\Traits

Code

protected function createFeed($feed_type_id, array $settings = []) {

  // Populate default array.
  $settings += [
    'title' => $this
      ->randomMachineName(),
  ];
  $settings['type'] = $feed_type_id;
  $feed = Feed::create($settings);
  $feed
    ->save();
  return $feed;
}