]> granicus.if.org Git - php/commitdiff
- Add tests
authorMarcus Boerger <helly@php.net>
Sun, 27 Feb 2005 23:15:52 +0000 (23:15 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 27 Feb 2005 23:15:52 +0000 (23:15 +0000)
ext/simplexml/tests/016a.phpt [new file with mode: 0755]
ext/simplexml/tests/022.phpt [new file with mode: 0755]

diff --git a/ext/simplexml/tests/016a.phpt b/ext/simplexml/tests/016a.phpt
new file mode 100755 (executable)
index 0000000..9797e29
--- /dev/null
@@ -0,0 +1,29 @@
+--TEST--
+SimpleXML: concatenating attributes
+--SKIPIF--
+<?php if (!extension_loaded("simplexml")) print "skip"; ?>
+--FILE--
+<?php 
+$xml =<<<EOF
+<people>
+   <person name="Foo"></person>
+</people>
+EOF;
+
+$people = simplexml_load_string($xml);
+var_dump($people->person['name']);
+$people->person['name'] .= 'Bar';
+var_dump($people->person['name']);
+
+?>
+===DONE===
+--EXPECTF--
+object(SimpleXMLElement)#%d (1) {
+  [0]=>
+  string(3) "Foo"
+}
+object(SimpleXMLElement)#%d (1) {
+  [0]=>
+  string(6) "FooBar"
+}
+===DONE===
diff --git a/ext/simplexml/tests/022.phpt b/ext/simplexml/tests/022.phpt
new file mode 100755 (executable)
index 0000000..08cb908
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+SimpleXML and attributes inside foreach
+--SKIPIF--
+<?php if (!extension_loaded("simplexml")) print "skip"; ?>
+--FILE--
+<?php 
+
+$xml =<<<EOF
+<?xml version='1.0'?>
+<pres><content><file glob="slide_*.xml"/></content></pres>
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+foreach($sxe->content->file as $file)
+{
+       var_dump($file);
+       var_dump($file['glob']);
+}
+
+?>
+===DONE===
+--EXPECTF--
+object(SimpleXMLElement)#%d (0) {
+}
+object(SimpleXMLElement)#%d (1) {
+  [0]=>
+  string(11) "slide_*.xml"
+}
+===DONE===