find('p:eq(1)') ->replaceWith("

this is example title

"); $result = pq('p:eq(1)'); if ( $result->hasClass('newTitle') ) print "Test '{$testName}' PASSED :)"; else print "Test '{$testName}' FAILED !!! "; $result->dump(); print "\n"; $testName = 'ReplaceAll'; $testResult = 3; phpQuery::newDocumentFile('test.html'); pq('
') ->replaceAll('li:first p'); $result = pq('.replacer'); if ( $result->size() == $testResult ) print "Test '{$testName}' PASSED :)"; else print "Test '{$testName}' FAILED !!! "; $result->dump(); print "\n";