mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
- Add tests
This commit is contained in:
parent
fef7cb4e29
commit
8de753f09e
29
ext/simplexml/tests/016a.phpt
Executable file
29
ext/simplexml/tests/016a.phpt
Executable file
@ -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===
|
30
ext/simplexml/tests/022.phpt
Executable file
30
ext/simplexml/tests/022.phpt
Executable file
@ -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===
|
Loading…
Reference in New Issue
Block a user