You are here

public function JmesPathParserTest::testInvalidJson in Feeds extensible parsers 8

Tests parsing invalid JSON.

File

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

Class

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

Namespace

Drupal\Tests\feeds_ex\Unit\Feeds\Parser

Code

public function testInvalidJson() {
  $config = [
    'context' => [
      'value' => 'items',
    ],
    'sources' => [],
  ];
  $this->parser
    ->setConfiguration($config);
  $this
    ->expectException(RuntimeException::class);
  $this
    ->expectExceptionMessage('The JSON is invalid.');
  $this->parser
    ->parse($this->feed, new RawFetcherResult('invalid json', $this->fileSystem), $this->state);
}