This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Component/CssSelector/XPathExprTest.php

36 lines
983 B
PHP
Raw Normal View History

<?php
/*
2010-04-25 16:06:54 +01:00
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Component\CssSelector;
use Symfony\Component\CssSelector\XPathExpr;
class XPathExprTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider getXPathLiteralValues
*/
public function testXpathLiteral($value, $literal)
{
$this->assertEquals($literal, XPathExpr::xpathLiteral($value));
}
public function getXPathLiteralValues()
{
return array(
array('foo', "'foo'"),
array("foo's bar", '"foo\'s bar"'),
array("foo's \"middle\" bar", 'concat(\'foo\', "\'", \'s "middle" bar\')'),
array("foo's 'middle' \"bar\"", 'concat(\'foo\', "\'", \'s \', "\'", \'middle\', "\'", \' "bar"\')'),
);
}
}