Annotation of embedaddon/php/ext/dom/tests/DOMDocument_saveHTMLFile_formatOutput.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: DOMDocument::saveHTMLFile() should format output on demand
! 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: $filename = dirname(__FILE__)."/tmp_savehtmlfile".time().".html";
! 13: $doc = new DOMDocument('1.0');
! 14: $doc->formatOutput = true;
! 15: $root = $doc->createElement('html');
! 16: $root = $doc->appendChild($root);
! 17: $head = $doc->createElement('head');
! 18: $head = $root->appendChild($head);
! 19: $title = $doc->createElement('title');
! 20: $title = $head->appendChild($title);
! 21: $text = $doc->createTextNode('This is the title');
! 22: $text = $title->appendChild($text);
! 23: $bytes = $doc->saveHTMLFile($filename);
! 24: var_dump($bytes);
! 25: echo file_get_contents($filename);
! 26: unlink($filename);
! 27: ?>
! 28: --EXPECTF--
! 29: int(129)
! 30: <html><head>
! 31: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
! 32: <title>This is the title</title>
! 33: </head></html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>