Annotation of embedaddon/php/ext/simplexml/tests/014.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SimpleXML: adding/removing attributes (direct)
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("simplexml")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: $xml =<<<EOF
! 8: <people>
! 9: <person name="Joe"></person>
! 10: </people>
! 11: EOF;
! 12:
! 13: $people = simplexml_load_string($xml);
! 14: var_dump($people->person['name']);
! 15: var_dump($people->person['age']);
! 16: $person = $people->person;
! 17: $person['name'] = "XXX";
! 18: var_dump($people->person['name']);
! 19: $people->person['age'] = 30;
! 20: var_dump($people->person['age']);
! 21: echo "---Unset:---\n";
! 22: unset($people->person['age']);
! 23: echo "---Unset?---\n";
! 24: var_dump($people->person['age']);
! 25: var_dump(isset($people->person['age']));
! 26: $people->person['age'] = 30;
! 27: echo "---Unsupported---\n";
! 28: var_dump($people->person['age']);
! 29: $people->person['age'] += 5;
! 30: var_dump($people->person['age']);
! 31: ?>
! 32: ===DONE===
! 33: --EXPECTF--
! 34: object(SimpleXMLElement)#%d (1) {
! 35: [0]=>
! 36: string(3) "Joe"
! 37: }
! 38: NULL
! 39: object(SimpleXMLElement)#%d (1) {
! 40: [0]=>
! 41: string(3) "XXX"
! 42: }
! 43: object(SimpleXMLElement)#%d (1) {
! 44: [0]=>
! 45: string(2) "30"
! 46: }
! 47: ---Unset:---
! 48: ---Unset?---
! 49: NULL
! 50: bool(false)
! 51: ---Unsupported---
! 52: object(SimpleXMLElement)#%d (1) {
! 53: [0]=>
! 54: string(2) "30"
! 55: }
! 56: object(SimpleXMLElement)#%d (1) {
! 57: [0]=>
! 58: string(2) "35"
! 59: }
! 60: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>