You are here

public function DirectoryFetcherFormTest::testConfigurationForm in Feeds 8.3

Tests the configuration form.

@covers ::buildConfigurationForm @covers ::validateConfigurationForm

File

tests/src/Unit/Feeds/Fetcher/Form/DirectoryFetcherFormTest.php, line 23

Class

DirectoryFetcherFormTest
@coversDefaultClass \Drupal\feeds\Feeds\Fetcher\Form\DirectoryFetcherForm @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Fetcher\Form

Code

public function testConfigurationForm() {
  $container = new ContainerBuilder();
  $container
    ->set('stream_wrapper_manager', $this
    ->getMockStreamWrapperManager());
  $plugin = $this
    ->prophesize(FeedsPluginInterface::class);
  $form_object = DirectoryFetcherForm::create($container);
  $form_object
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $form_object
    ->setPlugin($plugin
    ->reveal());
  $form_state = new FormState();
  $form = $form_object
    ->buildConfigurationForm([], $form_state);
  $form_state
    ->setValue('allowed_extensions', ' txt  pdf ');
  $form_object
    ->validateConfigurationForm($form, $form_state);
  $this
    ->assertSame('txt pdf', $form_state
    ->getValue('allowed_extensions'));
}