You are here

public function Common::getInstanceMock in Feeds Paragraphs 8

@inheritdoc

1 call to Common::getInstanceMock()
TestWrapperTarget::setUp in tests/src/Unit/TestWrapperTarget.php
@inheritdoc

File

tests/src/Unit/Helpers/Common.php, line 50

Class

Common

Namespace

Drupal\Tests\feeds_para_mapper\Unit\Helpers

Code

public function getInstanceMock() {
  $defaultConfig = array(
    'format' => 'default format',
  );
  $text = $this
    ->prophesize(Text::class);
  $form = array();
  $form['format'] = [
    '#type' => 'select',
    '#title' => 'Filter format',
    '#options' => array(
      'a',
      'b',
      'c',
    ),
  ];
  $translation = $this
    ->getStringTranslationStub();
  $text
    ->defaultConfiguration()
    ->willReturn($defaultConfig);
  $text
    ->buildConfigurationForm(Argument::type('array'), Argument::any())
    ->willReturn($form);
  $text
    ->submitConfigurationForm(Argument::any(), Argument::any())
    ->willReturn(null);
  $text
    ->getSummary()
    ->willReturn($translation
    ->translate("test summary"));
  $that = $this;
  $text
    ->setTarget(Argument::any(), Argument::any(), Argument::any(), Argument::any())
    ->will(function ($args) use ($that) {

    // @todo: maybe attach the value here
    $that->entityHelper->values[$args[2]] = $args[3];
  });
  return $text;
}