You are here

public function FeedTypeTest::testGetMappedSources in Feeds 8.3

@covers ::getMappedSources

File

tests/src/Unit/Entity/FeedTypeTest.php, line 96

Class

FeedTypeTest
@coversDefaultClass \Drupal\feeds\Entity\FeedType @group feeds

Namespace

Drupal\Tests\feeds\Unit\Entity

Code

public function testGetMappedSources() {
  $feed_type = $this
    ->getFeedTypeMock($this
    ->randomMachineName(), [
    'getMappings',
  ]);
  $feed_type
    ->expects($this
    ->once())
    ->method('getMappings')
    ->will($this
    ->returnValue([
    [
      'target' => 'feeds_item',
      'map' => [
        'guid' => 'guid',
      ],
      'unique' => [
        'guid' => TRUE,
      ],
    ],
    [
      'target' => 'title',
      'map' => [
        'value' => 'title',
      ],
    ],
    [
      'target' => 'body',
      'map' => [
        'value' => 'description',
      ],
      'settings' => [
        [
          'format' => 'plain_text',
        ],
      ],
    ],
  ]));
  $expected = [
    'guid' => 'guid',
    'title' => 'title',
    'description' => 'description',
  ];
  $this
    ->assertSame($expected, $feed_type
    ->getMappedSources());
}