public function CsvParserFeedFormTest::testFeedForm in Feeds 8.3
Tests the feed form.
@covers ::buildConfigurationForm @covers ::validateConfigurationForm @covers ::submitConfigurationForm
File
- tests/
src/ Unit/ Feeds/ Parser/ Form/ CsvParserFeedFormTest.php, line 24
Class
- CsvParserFeedFormTest
- @coversDefaultClass \Drupal\feeds\Feeds\Parser\Form\CsvParserFeedForm @group feeds
Namespace
Drupal\Tests\feeds\Unit\Feeds\Parser\FormCode
public function testFeedForm() {
$plugin = $this
->createMock(FeedsPluginInterface::class);
$feed = $this
->prophesize(FeedInterface::class);
$feed
->getConfigurationFor($plugin)
->willReturn([
'delimiter' => ',',
'no_headers' => FALSE,
]);
$feed
->setConfigurationFor($plugin, [
'delimiter' => ';',
'no_headers' => TRUE,
])
->shouldBeCalled();
$form_object = new CsvParserFeedForm();
$form_object
->setPlugin($plugin);
$form_object
->setStringTranslation($this
->getStringTranslationStub());
$form_state = new FormState();
$form = $form_object
->buildConfigurationForm([], $form_state, $feed
->reveal());
$this
->assertIsArray($form);
$form_state
->setValues([
'delimiter' => ';',
'no_headers' => TRUE,
]);
$form_object
->validateConfigurationForm($form, $form_state, $feed
->reveal());
$form_object
->submitConfigurationForm($form, $form_state, $feed
->reveal());
}