You are here

public function FractionTargetTest::testBuildConfigurationForm in Fraction 2.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/Feeds/Target/FractionTargetTest.php \Drupal\Tests\fraction\Unit\Feeds\Target\FractionTargetTest::testBuildConfigurationForm()

@covers ::buildConfigurationForm

File

tests/src/Unit/Feeds/Target/FractionTargetTest.php, line 126

Class

FractionTargetTest
@coversDefaultClass \Drupal\fraction\Feeds\Target\FractionTarget @group feeds

Namespace

Drupal\Tests\fraction\Unit\Feeds\Target

Code

public function testBuildConfigurationForm() {
  $method = $this
    ->getMethod('Drupal\\fraction\\Feeds\\Target\\FractionTarget', 'prepareTarget')
    ->getClosure();
  $configuration = [
    'feed_type' => $this
      ->createMock('Drupal\\feeds\\FeedTypeInterface'),
    'target_definition' => $method($this
      ->getMockFieldDefinition()),
  ];
  $target = new FractionTarget($configuration, 'fraction', []);
  $target
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $form_state = new FormState();
  $form = $target
    ->buildConfigurationForm([], $form_state);
  $this
    ->assertSame(count($form), 1);
  $this
    ->assertArrayHasKey('type', $form);
}