public function XpathTest::testEscapeXpathString in Views XML Backend 8
@covers ::escapeXpathString
File
- tests/
src/ Unit/ XpathTest.php, line 22 - Contains \Drupal\Tests\views_xml_backend\Unit\XpathTest
Class
- XpathTest
- @coversDefaultClass \Drupal\views_xml_backend\Xpath @group views_xml_backend
Namespace
Drupal\Tests\views_xml_backend\UnitCode
public function testEscapeXpathString() {
$this
->assertSame("'foo'", Xpath::escapeXpathString('foo'));
$this
->assertSame('"fo\'o"', Xpath::escapeXpathString("fo'o"));
// The complex bits.
$this
->assertSame('concat(\'"foo\', "\'", \'bar"\')', Xpath::escapeXpathString('"foo\'bar"'));
}