diff options
author | Pierre Joye <pajoye@php.net> | 2005-06-23 11:29:03 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2005-06-23 11:29:03 +0000 |
commit | 58cb6bb07f963cc3c733181f42f39a307de235e9 (patch) | |
tree | 9c4c01606d3bcf75dfa522279304f30f8a9c3de1 /ext/xmlwriter/tests/004.phpt | |
parent | 8c1c4865acf12fdac68c0cb5a420f3253bf82410 (diff) | |
download | php-git-58cb6bb07f963cc3c733181f42f39a307de235e9.tar.gz |
- initial tests
Diffstat (limited to 'ext/xmlwriter/tests/004.phpt')
-rw-r--r-- | ext/xmlwriter/tests/004.phpt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ext/xmlwriter/tests/004.phpt b/ext/xmlwriter/tests/004.phpt new file mode 100644 index 0000000000..f9d512739a --- /dev/null +++ b/ext/xmlwriter/tests/004.phpt @@ -0,0 +1,35 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, file buffer, flush +--SKIPIF-- +<?php if (!extension_loaded("xmlwriter")) print "skip"; ?> +--FILE-- +<?php +/* $Id$ */ + +$doc_dest = '001.xml'; +$xw = xmlwriter_open_uri($doc_dest); +xmlwriter_start_document($xw, '1.0', 'utf8'); +xmlwriter_start_element($xw, "tag1"); + +xmlwriter_start_pi($xw, "PHP"); +xmlwriter_text($xw, 'echo $a;'); +xmlwriter_end_pi($xw); +xmlwriter_end_document($xw); + +// Force to write and empty the buffer +$output_bytes = xmlwriter_flush($xw, true); +$md5_out = md5_file($doc_dest); +$md5_res = md5('<?xml version="1.0" encoding="utf8"?> +<tag1><?PHP echo $a;?></tag1> +'); +unlink('001.xml'); +if ($md5_out != $md5_res) { + echo "failed: $md5_res != $md5_out\n"; +} else { + echo "ok.\n"; +} +echo "---Done---\n"; +?> +--EXPECT-- +ok. +---Done--- |