5 changed files with 129 additions and 17 deletions
-
58ext/simplexml/tests/001.phpt
-
50ext/simplexml/tests/002.phpt
-
18ext/simplexml/tests/sxe.dtd
-
1ext/simplexml/tests/sxe.ent
-
19ext/simplexml/tests/sxe.xml
@ -1,24 +1,48 @@ |
|||
--TEST-- |
|||
Check for simplexml presence |
|||
SimpleXML without CDATA |
|||
--SKIPIF-- |
|||
<?php if (!extension_loaded("simplexml")) print "skip"; ?> |
|||
--POST-- |
|||
--GET-- |
|||
--INI-- |
|||
--FILE-- |
|||
<?php |
|||
echo "simplexml extension is available"; |
|||
/* |
|||
you can add regression tests for your extension here |
|||
|
|||
the output of your test code has to be equal to the |
|||
text in the --EXPECT-- section below for the tests |
|||
to pass, differences between the output and the |
|||
expected text are interpreted as failure |
|||
|
|||
see php4/README.TESTING for further information on |
|||
writing regression tests |
|||
*/ |
|||
|
|||
$sxe = simplexml_load_file(dirname(__FILE__).'/sxe.xml'); |
|||
|
|||
print_r($sxe); |
|||
|
|||
echo "---Done---\n"; |
|||
|
|||
?> |
|||
--EXPECT-- |
|||
simplexml extension is available |
|||
simplexml_element Object |
|||
( |
|||
[elem1] => simplexml_element Object |
|||
( |
|||
[comment] => simplexml_element Object |
|||
( |
|||
) |
|||
|
|||
[elem2] => simplexml_element Object |
|||
( |
|||
[elem3] => simplexml_element Object |
|||
( |
|||
[included-entity] => simplexml_element Object |
|||
( |
|||
[included-entity] => This is text included from an entity |
|||
) |
|||
|
|||
[elem4] => simplexml_element Object |
|||
( |
|||
[test] => simplexml_element Object |
|||
( |
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
---Done--- |
|||
@ -0,0 +1,50 @@ |
|||
--TEST-- |
|||
SimpleXML and clone |
|||
--SKIPIF-- |
|||
<?php if (!extension_loaded("simplexml")) print "skip"; ?> |
|||
--FILE-- |
|||
<?php |
|||
|
|||
$sxe = simplexml_load_file(dirname(__FILE__).'/sxe.xml'); |
|||
|
|||
$copy = $sxe->__clone; |
|||
|
|||
print_r($copy); |
|||
|
|||
echo "---Done---\n"; |
|||
|
|||
?> |
|||
--EXPECT-- |
|||
simplexml_element Object |
|||
( |
|||
[elem1] => simplexml_element Object |
|||
( |
|||
[comment] => simplexml_element Object |
|||
( |
|||
) |
|||
|
|||
[elem2] => simplexml_element Object |
|||
( |
|||
[elem3] => simplexml_element Object |
|||
( |
|||
[included-entity] => simplexml_element Object |
|||
( |
|||
[included-entity] => This is text included from an entity |
|||
) |
|||
|
|||
[elem4] => simplexml_element Object |
|||
( |
|||
[test] => simplexml_element Object |
|||
( |
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
|
|||
) |
|||
---Done--- |
|||
@ -0,0 +1,18 @@ |
|||
<?xml encoding='US-ASCII'?> |
|||
|
|||
<!ELEMENT sxe elem1> |
|||
<!ATTLIST sxe id> |
|||
|
|||
<!ELEMENT elem1 elem2> |
|||
<!ATTLIST elem1 attr1 CDATA #required |
|||
attr2 CDATA "default> |
|||
|
|||
<!ELEMENT elem2 elem3> |
|||
<!ATTLIST elem2> |
|||
|
|||
<!ELEMENT elem3 elem4> |
|||
<!ATTLIST elem3> |
|||
|
|||
<!ELEMENT elem4 EMPTY> |
|||
<!ATTLIST elem4> |
|||
|
|||
@ -0,0 +1 @@ |
|||
<!ENTITY included-entity "This is text included from an entity"> |
|||
@ -0,0 +1,19 @@ |
|||
<?xml version='1.0'?> |
|||
<!DOCTYPE sxe SYSTEM "notfound.dtd" [ |
|||
<!ENTITY % incent SYSTEM "sxe.ent"> |
|||
%incent; |
|||
]> |
|||
<sxe id="elem1"> |
|||
Plain text. |
|||
<elem1 attr1='first'> |
|||
<!-- comment --> |
|||
<elem2> |
|||
<elem3> |
|||
&included-entity; |
|||
<elem4> |
|||
<?test processing instruction ?> |
|||
</elem4> |
|||
</elem3> |
|||
</elem2> |
|||
</elem1> |
|||
</sxe> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue