find('li') ->slice(1, 2); if ( $result->whois() == $testResult ) print "Test 'Slice1' PASSED :)"; else { print "Test 'Slice1' FAILED !!! "; print "
"; print_r($result->whois()); print "\n"; } print "\n"; // SLICE2 $testResult = array( 'li#testID', 'li', 'li#i_have_nested_list', 'li.nested', ); $result = phpQuery::newDocumentFile('test.html') ->find('li') ->slice(1, -1); if ( $result->whois() == $testResult ) print "Test 'Slice2' PASSED :)"; else { print "Test 'Slice2' FAILED !!! "; print "
"; print_r($result->whois()); print "\n"; } print "\n"; // Multi-insert $result = phpQuery::newDocument('
"; var_dump($result->htmlOuter()); print "\n"; } print "\n"; // INDEX $testResult = 1; $result = phpQuery::newDocumentFile('test.html') ->find('p') ->index(pq('p.title:first')); if ( $result == $testResult ) print "Test 'Index' PASSED :)"; else { print "Test 'Index' FAILED !!! "; } print "\n"; // CLONE $testName = 'Clone'; $testResult = 3; $document; $p = phpQuery::newDocumentFile('test.html') ->toReference($document) ->find('p:first'); foreach(array(0,1,2) as $i) { $p->clone() ->addClass("clone-test") ->addClass("class-$i") ->insertBefore($p); } if (pq('.clone-test')->size() == $testResult) print "Test '$testName' PASSED :)"; else { print "Test '$testName' FAILED !!! "; } print "\n"; // SIBLINGS $testName = 'Next'; $testResult = 3; $document; $result = phpQuery::newDocumentFile('test.html') ->find('li:first') ->next() ->next() ->prev() ->is('#testID'); if ($result) print "Test '$testName' PASSED :)"; else { print "Test '$testName' FAILED !!! "; } print "\n"; ?>