ParserTestBase.php in Feeds extensible parsers 8
File
tests/src/Functional/Feeds/Parser/ParserTestBase.php
View source
<?php
namespace Drupal\Tests\feeds_ex\Functional\Feeds\Parser;
use Drupal\Tests\feeds_ex\Functional\FeedsExBrowserTestBase;
abstract class ParserTestBase extends FeedsExBrowserTestBase {
protected $feedType;
protected $parserId = '';
public function setUp() {
parent::setUp();
$this->feedType = $this
->createFeedType([
'parser' => $this->parserId,
]);
}
public function doMappingTest() {
$this
->drupalGet('/admin/structure/feeds/manage/' . $this->feedType
->id() . '/mapping');
$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');
$this->feedType = $this
->reloadEntity($this->feedType);
$expected_sources = [
'name' => [
'label' => 'name',
'value' => 'name',
],
];
$this
->assertEquals($expected_sources, $this->feedType
->getParser()
->getConfiguration('sources'));
}
}