test_insert.php 654 B

1234567891011121314151617181920
  1. <?php
  2. require_once('../phpQuery/phpQuery.php');
  3. phpQuery::$debug = 2;
  4. $testName = 'HTML insertion';
  5. $doc = phpQuery::newDocumentFile('document-types/document-utf8.xhtml');
  6. //$doc = phpQuery::newDocumentFile('document-types/document-utf8.html');
  7. //$doc = phpQuery::newDocumentFile('document-types/document-utf8.xml');
  8. //print $doc->find('step');
  9. print $doc->find('p');
  10. $markup = "test<br />test<p>test p</p>";
  11. $doc['body > p:last']->append($markup);
  12. if ($doc['body > p:last p']->length == 1)
  13. print "Test '{$testName}' PASSED :)";
  14. else {
  15. print "Test '{$testName}' <strong>FAILED</strong> !!! ";
  16. print $doc->htmlOuter('htmlspecialchars');
  17. }
  18. print "\n";