feeds-8.x-3.0-alpha1/tests/src/Unit/Feeds/Parser/Form/CsvParserFeedFormTest.php

tests/src/Unit/Feeds/Parser/Form/CsvParserFeedFormTest.php
<?php

namespace Drupal\Tests\feeds\Unit\Feeds\Parser\Form;

use Drupal\Core\Form\FormState;
use Drupal\Tests\feeds\Unit\FeedsUnitTestCase;
use Drupal\feeds\FeedInterface;
use Drupal\feeds\Feeds\Parser\Form\CsvParserFeedForm;
use Drupal\feeds\Plugin\Type\FeedsPluginInterface;

/**
 * @coversDefaultClass \Drupal\feeds\Feeds\Parser\Form\CsvParserFeedForm
 * @group feeds
 */
class CsvParserFeedFormTest extends FeedsUnitTestCase {

  /**
   * Tests the feed form.
   *
   * @covers ::buildConfigurationForm
   * @covers ::validateConfigurationForm
   * @covers ::submitConfigurationForm
   */
  public function testFeedForm() {
    $plugin = $this->prophesize(FeedsPluginInterface::class);

    $feed = $this->prophesize(FeedInterface::class);
    $feed->getConfigurationFor($plugin->reveal())
      ->willReturn(['delimiter' => ',', 'no_headers' => FALSE]);

    $form_object = new CsvParserFeedForm();

    $form_object->setPlugin($plugin->reveal());
    $form_object->setStringTranslation($this->getStringTranslationStub());

    $form_state = new FormState();

    $form = $form_object->buildConfigurationForm([], $form_state, $feed->reveal());

    $form_object->validateConfigurationForm($form, $form_state, $feed->reveal());

    $form_object->submitConfigurationForm($form, $form_state, $feed->reveal());
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc