You are here

public function JsonPathParserTest::testInvalidJson in Feeds extensible parsers 8

Tests parsing invalid JSON.

File

tests/src/Unit/Feeds/Parser/JsonPathParserTest.php, line 150

Class

JsonPathParserTest
@coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\JsonPathParser @group feeds_ex

Namespace

Drupal\Tests\feeds_ex\Unit\Feeds\Parser

Code

public function testInvalidJson() {
  $config = [
    'context' => [
      'value' => '$.items[asdfasdf]',
    ],
  ] + $this->parser
    ->defaultConfiguration();
  $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);
}