public function JmesPathLinesParserTest::setUp in Feeds extensible parsers 8
Overrides JsonPathLinesParserTest::setUp
File
- tests/src/ Unit/ Feeds/ Parser/ JmesPathLinesParserTest.php, line 23 
Class
- JmesPathLinesParserTest
- @coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\JmesPathLinesParser @group feeds_ex
Namespace
Drupal\Tests\feeds_ex\Unit\Feeds\ParserCode
public function setUp() {
  parent::setUp();
  $configuration = [
    'feed_type' => $this->feedType,
  ];
  $utility = new JsonUtility();
  $utility
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $this->parser = new JmesPathLinesParser($configuration, 'jmespathlines', [], $utility);
  $this->parser
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $this->parser
    ->setFeedsExMessenger(new TestMessenger());
  $config = [
    'sources' => [
      'title' => [
        'name' => 'Title',
        'value' => 'name',
      ],
    ],
  ];
  $this->parser
    ->setConfiguration($config);
  // Set JMESPath runtime factory.
  $factoryMock = $this
    ->createMock('Drupal\\feeds_ex\\JmesRuntimeFactoryInterface');
  $factoryMock
    ->expects($this
    ->any())
    ->method('createRuntime')
    ->will($this
    ->returnCallback(function () {
    return new AstRuntime();
  }));
  $this->parser
    ->setRuntimeFactory($factoryMock);
  $this->fetcherResult = new FetcherResult($this->moduleDir . '/tests/resources/test.jsonl');
}