DOMDocument_saveHTML_basic.phpt 699 B

123456789101112131415161718192021222324
  1. --TEST--
  2. DOMDocument::saveHTML() should dump the internal document into a string using HTML formatting
  3. --CREDITS--
  4. Knut Urdalen <knut@php.net>
  5. #PHPTestFest2009 Norway 2009-06-09 \o/
  6. --SKIPIF--
  7. <?php
  8. require_once dirname(__FILE__) .'/skipif.inc';
  9. ?>
  10. --FILE--
  11. <?php
  12. $doc = new DOMDocument('1.0');
  13. $root = $doc->createElement('html');
  14. $root = $doc->appendChild($root);
  15. $head = $doc->createElement('head');
  16. $head = $root->appendChild($head);
  17. $title = $doc->createElement('title');
  18. $title = $head->appendChild($title);
  19. $text = $doc->createTextNode('This is the title');
  20. $text = $title->appendChild($text);
  21. echo $doc->saveHTML();
  22. ?>
  23. --EXPECTF--
  24. <html><head><title>This is the title</title></head></html>