diff options
| -rw-r--r-- | ext/simplexml/tests/profile01.phpt | 18 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile02.phpt | 21 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile03.phpt | 18 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile04.phpt | 18 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile05.phpt | 22 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile06.phpt | 19 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile07.phpt | 22 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile08.phpt | 19 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile09.phpt | 19 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile10.phpt | 25 | ||||
| -rw-r--r-- | ext/simplexml/tests/profile11.phpt | 26 |
11 files changed, 227 insertions, 0 deletions
diff --git a/ext/simplexml/tests/profile01.phpt b/ext/simplexml/tests/profile01.phpt new file mode 100644 index 0000000000..91b9544f66 --- /dev/null +++ b/ext/simplexml/tests/profile01.phpt @@ -0,0 +1,18 @@ +--TEST-- +SimpleXML [profile]: Accessing a simple node +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +$root = simplexml_load_string('<?xml version="1.0"?> +<root> + <child>Hello</child> +</root> +'); + +echo $root->child; +echo "\n---Done---\n"; +?> +--EXPECT-- +Hello +---Done--- diff --git a/ext/simplexml/tests/profile02.phpt b/ext/simplexml/tests/profile02.phpt new file mode 100644 index 0000000000..14b5bb86b2 --- /dev/null +++ b/ext/simplexml/tests/profile02.phpt @@ -0,0 +1,21 @@ +--TEST-- +SimpleXML [profile]: Accessing an array of subnodes +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +$root = simplexml_load_string('<?xml version="1.0"?> +<root> + <child>Hello</child> + <child>World</child> +</root> +'); + +foreach ($root->child as $child) { + echo "$child "; +} +echo "\n---Done---\n"; +?> +--EXPECT-- +Hello World +---Done--- diff --git a/ext/simplexml/tests/profile03.phpt b/ext/simplexml/tests/profile03.phpt new file mode 100644 index 0000000000..14f1c5fe88 --- /dev/null +++ b/ext/simplexml/tests/profile03.phpt @@ -0,0 +1,18 @@ +--TEST-- +SimpleXML [profile]: Accessing an attribute +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +$root = simplexml_load_string('<?xml version="1.0"?> +<root> + <child attribute="Sample" /> +</root> +'); + +echo $root->child['attribute']; +echo "\n---Done---\n"; +?> +--EXPECT-- +Sample +---Done--- diff --git a/ext/simplexml/tests/profile04.phpt b/ext/simplexml/tests/profile04.phpt new file mode 100644 index 0000000000..bc15968eaa --- /dev/null +++ b/ext/simplexml/tests/profile04.phpt @@ -0,0 +1,18 @@ +--TEST-- +SimpleXML [profile]: Accessing a namespaced element +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns"> + <reserved:child>Hello</reserved:child> +</root> +'); + +echo $root->reserved->child; +echo "\n---Done---\n"; +?> +--EXPECT-- +Hello +---Done--- diff --git a/ext/simplexml/tests/profile05.phpt b/ext/simplexml/tests/profile05.phpt new file mode 100644 index 0000000000..d4f651b57e --- /dev/null +++ b/ext/simplexml/tests/profile05.phpt @@ -0,0 +1,22 @@ +--TEST-- +SimpleXML [profile]: Accessing an aliased namespaced element +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns"> + <reserved:child>Hello</reserved:child> +</root> +'); + +$root->register_ns('myns', 'reserved-ns'); + +echo $root->myns->child; +echo $root->reserved->child; +echo "\n---Done---\n"; +?> +--EXPECT-- +Hello +---Done--- diff --git a/ext/simplexml/tests/profile06.phpt b/ext/simplexml/tests/profile06.phpt new file mode 100644 index 0000000000..e1817f30a9 --- /dev/null +++ b/ext/simplexml/tests/profile06.phpt @@ -0,0 +1,19 @@ +--TEST-- +SimpleXML [profile]: Accessing a namespaced attribute +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns"> + <child reserved:attribute="Sample" /> +</root> +'); + +echo $root->child['reserved:attribute']; +echo "\n---Done---\n"; +?> +--EXPECT-- +Sample +---Done--- diff --git a/ext/simplexml/tests/profile07.phpt b/ext/simplexml/tests/profile07.phpt new file mode 100644 index 0000000000..b76e6ddc95 --- /dev/null +++ b/ext/simplexml/tests/profile07.phpt @@ -0,0 +1,22 @@ +--TEST-- +SimpleXML [profile]: Accessing an aliased namespaced attribute +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns"> + <child reserved:attribute="Sample" /> +</root> +'); + +$root->register_ns('myns', 'reserved-ns'); + +echo $root->child['reserved:attribute']; +echo $root->child['myns:attribute']; +echo "\n---Done---\n"; +?> +--EXPECT-- +Sample +---Done--- diff --git a/ext/simplexml/tests/profile08.phpt b/ext/simplexml/tests/profile08.phpt new file mode 100644 index 0000000000..6fedb4859a --- /dev/null +++ b/ext/simplexml/tests/profile08.phpt @@ -0,0 +1,19 @@ +--TEST-- +SimpleXML [profile]: Accessing a namespaced attribute without a namespace +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns"> + <child reserved:attribute="Sample" /> +</root> +'); + +echo $root->child['attribute']; +echo "\n---Done---\n"; +?> +--EXPECT-- + +---Done--- diff --git a/ext/simplexml/tests/profile09.phpt b/ext/simplexml/tests/profile09.phpt new file mode 100644 index 0000000000..714572df1e --- /dev/null +++ b/ext/simplexml/tests/profile09.phpt @@ -0,0 +1,19 @@ +--TEST-- +SimpleXML [profile]: Accessing a namespaced element without a namespace +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns"> + <reserved:child>Hello</reserved:child> +</root> +'); + +echo $root->child; +echo "\n---Done---\n"; +?> +--EXPECT-- + +---Done--- diff --git a/ext/simplexml/tests/profile10.phpt b/ext/simplexml/tests/profile10.phpt new file mode 100644 index 0000000000..747b056fcb --- /dev/null +++ b/ext/simplexml/tests/profile10.phpt @@ -0,0 +1,25 @@ +--TEST-- +SimpleXML [profile]: Accessing two attributes with the same name, but different namespaces +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns" xmlns:special="special-ns"> + <child reserved:attribute="Sample" special:attribute="Test" /> +</root> +'); + +echo $root->child['reserved:attribute']; +echo "\n"; +echo $root->child['special:attribute']; +foreach ($root->child['attribute'] as $attr) { + echo "$attr\n"; +} +echo "\n---Done---\n"; +?> +--EXPECT-- +Sample +Test +---Done--- diff --git a/ext/simplexml/tests/profile11.phpt b/ext/simplexml/tests/profile11.phpt new file mode 100644 index 0000000000..f9dd2dc58e --- /dev/null +++ b/ext/simplexml/tests/profile11.phpt @@ -0,0 +1,26 @@ +--TEST-- +SimpleXML [profile]: Accessing two elements with the same name, but different namespaces +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +$root = simplexml_load_string('<?xml version="1.0"?> +<root xmlns:reserved="reserved-ns" xmlns:special="special-ns"> + <reserved:child>Hello</reserved:child> + <special:child>World</special:child> +</root> +'); + +echo $root->reserved->child; +echo "\n"; +echo $root->special->child; +foreach ($root->child as $child) { + echo "$child\n"; +} +echo "\n---Done---\n"; +?> +--EXPECT-- +Hello +World +---Done--- |
