Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Dec 17, 2003
1 parent 3c4cfd3 commit 1292337
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ext/simplexml/tests/014.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--TEST--
SimpleXML: adding/removing attributes
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml =<<<EOF
<people>
<person name="Joe"></person>
<person name="Boe"></person>
</people>
EOF;

$people = simplexml_load_string($xml);
var_dump($people->person[0]['name']);
var_dump($people->person[0]['age']);
$people->person[0]['name'] = "XXX";
$people->person[0]['age'] = 30;
var_dump($people->person[0]['name']);
var_dump($people->person[0]['age']);
$people->person[0]['age'] += 5;
var_dump($people->person[0]['age']);
unset($people->person[0]['age']);
var_dump($people->person[0]['age']);
var_dump(isset($people->person[0]['age']));
echo "---Done---\n";
?>
--EXPECT--
string(3) "Joe"
NULL
string(3) "XXX"
string(2) "30"
string(2) "35"
NULL
bool(false)
---Done---
40 changes: 40 additions & 0 deletions ext/simplexml/tests/015.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--TEST--
SimpleXML: accessing singular subnode as array
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml =<<<EOF
<people>
<person name="Joe"></person>
</people>
EOF;

$people = simplexml_load_string($xml);
var_dump($people->person['name']);
var_dump($people->person[0]['name']);
$people->person['name'] = "XXX";
var_dump($people->person['name']);
var_dump($people->person[0]['name']);
$people->person[0]['name'] = "YYY";
var_dump($people->person['name']);
var_dump($people->person[0]['name']);
unset($people->person[0]['name']);
var_dump($people->person['name']);
var_dump($people->person[0]['name']);
var_dump(isset($people->person['name']));
var_dump(isset($people->person[0]['name']));
echo "---Done---\n";
?>
--EXPECT--
string(3) "Joe"
string(3) "Joe"
string(3) "XXX"
string(3) "XXX"
string(3) "YYY"
string(3) "YYY"
NULL
NULL
bool(false)
bool(false)
---Done---
26 changes: 26 additions & 0 deletions ext/simplexml/tests/016.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
SimpleXML: modifying attributes of singular subnode
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml =<<<EOF
<people>
<person name="Joe"></person>
</people>
EOF;

$people = simplexml_load_string($xml);
var_dump($people->person['name']);
var_dump($people->person[0]['name']);
$people->person[0]['name'] .= "ZZZ";
var_dump($people->person['name']);
var_dump($people->person[0]['name']);
echo "---Done---\n";
?>
--EXPECT--
string(3) "Joe"
string(3) "Joe"
string(3) "JoeZZZ"
string(3) "JoeZZZ"
---Done---

0 comments on commit 1292337

Please sign in to comment.