You are here

public function ParserTestBase::doMappingTest in Feeds extensible parsers 8

Tests basic mapping.

2 calls to ParserTestBase::doMappingTest()
JmesPathLinesParserTest::testMapping in tests/src/Functional/Feeds/Parser/JmesPathLinesParserTest.php
Does a basic mapping test.
JsonPathLinesParserTest::testMapping in tests/src/Functional/Feeds/Parser/JsonPathLinesParserTest.php
Does a basic mapping test.

File

tests/src/Functional/Feeds/Parser/ParserTestBase.php, line 41

Class

ParserTestBase
Base class for parser functional tests.

Namespace

Drupal\Tests\feeds_ex\Functional\Feeds\Parser

Code

public function doMappingTest() {
  $this
    ->drupalGet('/admin/structure/feeds/manage/' . $this->feedType
    ->id() . '/mapping');

  // Set source for title target.
  $edit = [
    'mappings[1][map][value][select]' => '__new',
    'mappings[1][map][value][__new][value]' => 'name',
    'mappings[1][map][value][__new][machine_name]' => 'name',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');

  // Now check the parser configuration.
  $this->feedType = $this
    ->reloadEntity($this->feedType);
  $expected_sources = [
    'name' => [
      'label' => 'name',
      'value' => 'name',
    ],
  ];
  $this
    ->assertEquals($expected_sources, $this->feedType
    ->getParser()
    ->getConfiguration('sources'));
}