You are here

public function QueryPathXmlParserTest::testValidateExpression in Feeds extensible parsers 8

Tests QueryPath validation.

File

tests/src/Unit/Feeds/Parser/QueryPathXmlParserTest.php, line 309

Class

QueryPathXmlParserTest
@coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\QueryPathXmlParser @group feeds_ex

Namespace

Drupal\Tests\feeds_ex\Unit\Feeds\Parser

Code

public function testValidateExpression() {

  // Invalid expression.
  $expression = '!! ';
  $this
    ->assertSame('CSS selector is not well formed.', (string) $this
    ->invokeMethod($this->parser, 'validateExpression', [
    &$expression,
  ]));

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

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