You are here

public function JmesPathParserTest::testInvalidContextExpression in Feeds extensible parsers 8

Tests parsing invalid context expression.

File

tests/src/Unit/Feeds/Parser/JmesPathParserTest.php, line 188

Class

JmesPathParserTest
@coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\JmesPathParser @group feeds_ex

Namespace

Drupal\Tests\feeds_ex\Unit\Feeds\Parser

Code

public function testInvalidContextExpression() {
  $config = [
    'context' => [
      'value' => 'items',
    ],
    'sources' => [],
  ];
  $this->parser
    ->setConfiguration($config);
  $this
    ->expectException(RuntimeException::class);
  $this
    ->expectExceptionMessage('The context expression must return an object or array.');
  $this->parser
    ->parse($this->feed, new RawFetcherResult('{"items": "not an array"}', $this->fileSystem), $this->state);
}