test_multidoc.php
1.0 KB
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
<?php
require_once('../phpQuery/phpQuery.php');
phpQuery::$debug = true;
$testName = 'Multi document append phpQuery object';
$testResult = array(
'p.body',
);
$doc1 = phpQuery::newDocumentFile('test.html');
$doc2 = phpQuery::newDocumentFile('test.html');
foreach ($doc1->find('p') as $node)
$doc2->find('body')->append(pq($node));
$testResult = $doc2->find('p');
if ( $testResult->size() == 2*$doc1->find('p')->size() )
print "Test '{$testName}' PASSED :)";
else {
print "Test '{$testName}' <strong>FAILED</strong> !!!<br />";
$testResult->whois();
}
$testName = 'Multi document append DOMNode';
$testResult = array(
'p.body',
);
$doc1 = phpQuery::newDocumentFile('test.html');
$doc2 = phpQuery::newDocumentFile('test.html');
foreach ($doc1->find('p') as $node)
$doc2->find('body')->append($node);
$testResult = $doc2->find('p');
if ( $testResult->size() == 2*$doc1->find('p')->size() )
print "Test '{$testName}' PASSED :)";
else {
print "Test '{$testName}' <strong>FAILED</strong> !!!<br />";
$testResult->whois();
}
?>