public function JmesPathParserTest::setUp in Feeds extensible parsers 8
Overrides ParserTestBase::setUp
File
- tests/
src/ Unit/ Feeds/ Parser/ JmesPathParserTest.php, line 21  
Class
- JmesPathParserTest
 - @coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\JmesPathParser @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 JmesPathParser($configuration, 'jmespath', [], $utility);
  $this->parser
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $this->parser
    ->setFeedsExMessenger(new TestMessenger());
  // 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);
}