Annotation of embedaddon/php/ext/xmlwriter/tests/OO_004.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: XMLWriter: libxml2 XML Writer, file buffer, flush
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: /* $Id: OO_004.phpt 316312 2011-09-07 09:37:56Z pajoye $ */
! 8:
! 9: $doc_dest = '001.xml';
! 10: $xw = new XMLWriter();
! 11: $xw->openUri($doc_dest);
! 12: $xw->startDocument('1.0', 'UTF-8');
! 13: $xw->startElement("tag1");
! 14:
! 15: $xw->startPi("PHP");
! 16: $xw->text('echo $a;');
! 17: $xw->endPi();
! 18: $xw->endDocument();
! 19:
! 20: // Force to write and empty the buffer
! 21: $xw->flush(true);
! 22: $md5_out = md5_file($doc_dest);
! 23: $md5_res = md5('<?xml version="1.0" encoding="UTF-8"?>
! 24: <tag1><?PHP echo $a;?></tag1>
! 25: ');
! 26: unset($xw);
! 27: unlink('001.xml');
! 28: if ($md5_out != $md5_res) {
! 29: echo "failed: $md5_res != $md5_out\n";
! 30: } else {
! 31: echo "ok.\n";
! 32: }
! 33: ?>
! 34: ===DONE===
! 35: --EXPECT--
! 36: ok.
! 37: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>