-
Notifications
You must be signed in to change notification settings - Fork 290
Expand file tree
/
Copy pathEscaperTest.php
More file actions
32 lines (27 loc) · 899 Bytes
/
EscaperTest.php
File metadata and controls
32 lines (27 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace Behat\Mink\Tests\Selector\Xpath;
use Behat\Mink\Selector\Xpath\Escaper;
use PHPUnit\Framework\TestCase;
class EscaperTest extends TestCase
{
/**
* @dataProvider getXpathLiterals
*/
public function testXpathLiteral($string, $expected)
{
$escaper = new Escaper();
$this->assertEquals($expected, $escaper->escapeLiteral($string));
}
public static function getXpathLiterals()
{
return array(
array('some simple string', "'some simple string'"),
array('some "d-brackets" string', "'some \"d-brackets\" string'"),
array('some \'s-brackets\' string', "\"some 's-brackets' string\""),
array(
'some \'s-brackets\' and "d-brackets" string',
'concat(\'some \',"\'",\'s-brackets\',"\'",\' and "d-brackets" string\')',
),
);
}
}