-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_php.php
36 lines (34 loc) · 1.03 KB
/
test_php.php
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
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<?php
require_once('../phpQuery/phpQuery.php');
phpQuery::$debug = true;
$testName = 'PHP Code output';
$expected = <<<EOF
<?php print \$r ?><a href="<?php print \$array['key']; if ("abc'd'") {}; ?>"></a>
EOF;
$result = phpQuery::newDocumentPHP(null, 'text/html;charset=utf-8')
->appendPHP('print $r')
->append('<a/>')
->find('a')
->attrPHP('href', 'print $array[\'key\']; if ("abc\'d\'") {};')
->end();
if (trim($result->php()) == $expected)
print "Test '{$testName}' passed :)";
else
print "Test '{$testName}' <strong>FAILED</strong> !!!";
print "\n";
$testName = 'PHP file open';
$result = phpQuery::newDocumentFilePHP('document-types/document-utf8.php');
var_dump($result->php());
/*
->appendPHP('print $r')
->append('<a/>')
->find('a')
->attrPHP('href', 'print $array[\'key\']; if ("abc\'d\'") {};')
->end();
if (trim($result->php()) == $expected)
print "Test '{$testName}' passed :)";
else
print "Test '{$testName}' <strong>FAILED</strong> !!!";
print "\n";
*/