You are here

public function JmesPathParserTest::testValidateExpression in Feeds extensible parsers 8

Tests JMESPath validation.

File

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

Class

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

Namespace

Drupal\Tests\feeds_ex\Unit\Feeds\Parser

Code

public function testValidateExpression() {

  // Invalid expression.
  $expression = '!! ';
  $this
    ->assertStringStartsWith('<pre>Syntax error at character', $this
    ->invokeMethod($this->parser, 'validateExpression', [
    &$expression,
  ]));

  // Test that value was trimmed.
  $this
    ->assertSame($expression, '!!', 'Value was trimmed.');

  // Empty string.
  $empty = '';
  $this
    ->assertSame(NULL, $this
    ->invokeMethod($this->parser, 'validateExpression', [
    &$empty,
  ]));
}