find('p') ->slice(1, 3); $p->wrap('
'); $result = true; foreach($p as $node) { if (! pq($node)->parent()->is('.wrapper')) $result = false; } if ($result) print "Test '{$testName}' PASSED :)"; else print "Test '{$testName}' FAILED !!! "; $p->dump(); print "\n"; $testName = 'WrapAll'; $testResult = 1; phpQuery::newDocumentFile('test.html') ->find('p') ->slice(1, 3) ->wrapAll('
'); $result = pq('.wrapper'); if ( $result->size() == $testResult ) print "Test '{$testName}' PASSED :)"; else print "Test '{$testName}' FAILED !!! "; $result->dump(); print "\n"; $testName = 'WrapInner'; $testResult = 3; phpQuery::newDocumentFile('test.html') ->find('li:first') ->wrapInner('
'); $result = pq('.wrapper p'); if ( $result->size() == $testResult ) print "Test '{$testName}' PASSED :)"; else print "Test '{$testName}' FAILED !!! "; print $result->dump(); print "\n"; // TODO ! $testName = 'WrapAllTest'; /* $doc = phpQuery::newDocumentHTML('
'); $doc['#myDiv']->append('hors paragraphe

Test

hors paragraphe') ->contents() ->not('[nodeType=1]') ->wrap('

'); var_dump((string)$doc); */ //$testResult = 3; //phpQuery::newDocumentFile('test.html') // ->find('li:first') // ->wrapInner('

'); //$result = pq('.wrapper p'); //if ( $result->size() == $testResult ) // print "Test '{$testName}' PASSED :)"; //else // print "Test '{$testName}' FAILED !!! "; //print $result->dump(); //print "\n"; ?>