summaryrefslogtreecommitdiff
path: root/ext/dom/tests/DOMDocument_encoding_basic.phpt
diff options
context:
space:
mode:
authorZoe Slattery <zoe@php.net>2009-08-26 17:17:58 (GMT)
committerZoe Slattery <zoe@php.net>2009-08-26 17:17:58 (GMT)
commit7effcd5f6c1cc2b1851bd0d5ef1ee06d89ba438a (patch)
tree036937e1cdb922ef28574653165cf8969f3e9e7b /ext/dom/tests/DOMDocument_encoding_basic.phpt
parent1a372313ca8e106b3816053ca9869282be01b6d1 (diff)
downloadphp-7effcd5f6c1cc2b1851bd0d5ef1ee06d89ba438a.tar.gz
Test from 2009 testfest
Diffstat (limited to 'ext/dom/tests/DOMDocument_encoding_basic.phpt')
-rw-r--r--ext/dom/tests/DOMDocument_encoding_basic.phpt52
1 files changed, 52 insertions, 0 deletions
diff --git a/ext/dom/tests/DOMDocument_encoding_basic.phpt b/ext/dom/tests/DOMDocument_encoding_basic.phpt
new file mode 100644
index 0000000..9fc099b
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_encoding_basic.phpt
@@ -0,0 +1,52 @@
+--TEST--
+DOMDocument::$encoding - read/write tests (dom_document_encoding_read/dom_document_encoding_write)
+--CREDITS--
+Hans Zaunere
+# TestFest 2009 NYPHP
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('dom_test.inc');
+
+$dom = new DOMDocument;
+$dom->loadXML($xmlstr);
+
+if( !$dom )
+{
+ echo "Error while parsing the document\n";
+ exit;
+}
+
+echo "Empty Encoding Read: {$dom->encoding}\n";
+
+$ret = $dom->encoding = 'NYPHP DOMinatrix';
+echo "Adding invalid encoding: $ret\n";
+
+$ret = $dom->encoding = 'ISO-8859-1';
+echo "Adding ISO-8859-1 encoding: $ret\n";
+echo "ISO-8859-1 Encoding Read: {$dom->encoding}\n";
+
+$ret = $dom->encoding = 'UTF-8';
+echo "Adding UTF-8 encoding: $ret\n";
+echo "UTF-8 Encoding Read: {$dom->encoding}\n";
+
+$ret = $dom->encoding = 'UTF-16';
+echo "Adding UTF-16 encoding: $ret\n";
+echo "UTF-16 Encoding Read: {$dom->encoding}\n";
+
+
+?>
+--EXPECTF--
+Empty Encoding Read:
+
+Warning: main(): Invalid Document Encoding in %s on line %d
+Adding invalid encoding: NYPHP DOMinatrix
+Adding ISO-8859-1 encoding: ISO-8859-1
+ISO-8859-1 Encoding Read: ISO-8859-1
+Adding UTF-8 encoding: UTF-8
+UTF-8 Encoding Read: UTF-8
+Adding UTF-16 encoding: UTF-16
+UTF-16 Encoding Read: UTF-16
+