forked from chibimagic/WebDriver-PHP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebDriverXPathTest.php
More file actions
38 lines (35 loc) · 898 Bytes
/
WebDriverXPathTest.php
File metadata and controls
38 lines (35 loc) · 898 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
33
34
35
36
37
38
<?php
require_once 'WebDriver.php';
class WebDriverXPathTest extends PHPUnit_Framework_TestCase {
public function data() {
$strings = <<<EOT
noquotes
single'quote
double"quote
multiple'single'quotes
multiple"double"quotes
'beginning and ending single quotes'
"beginning and ending double quotes"
both'kinds of"quote
both"kinds of'quote
multiple'quotes'of"both"kinds
multiple'quotes"interspersed'with"each'other
consecutive''''quotes
consecutive""""quotes
consecutive'"'"'mixedquotes
EOT;
$test_data = split("\n", $strings);
foreach ($test_data as &$data) {
$data = array($data);
}
return $test_data;
}
/**
* @dataProvider data
*/
public function test($text) {
$xml = simplexml_load_string('<tag>' . $text . '</tag>');
$result = $xml->xpath('//tag[text()=' . WebDriver::QuoteXPath($text) . ']');
$this->assertEquals(count($result), 1);
}
}