File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
spl /
tests /
arrayObject_exchangeArray_basic2.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
SPL: ArrayObject::exchangeArray() with various object arguments
--FILE--
<?php
echo "--> exchangeArray(array):\n";
$ao = new ArrayObject();
$ao->exchangeArray(array('key'=>'original'));
var_dump($ao['key']);
var_dump($ao);
echo "\n--> exchangeArray(normal object):\n";
$obj = new stdClass;
$obj->key = 'normal object prop';
$ao->exchangeArray($obj);
var_dump($ao['key']);
var_dump($ao);
echo "\n--> exchangeArray(ArrayObject):\n";
$obj = new ArrayObject(array('key'=>'ArrayObject element'));
$ao->exchangeArray($obj);
var_dump($ao['key']);
var_dump($ao);
echo "\n--> exchangeArray(ArrayIterator):\n";
$obj = new ArrayIterator(array('key'=>'ArrayIterator element'));
$ao->exchangeArray($obj);
var_dump($ao['key']);
var_dump($ao);
echo "\n--> exchangeArray(nested ArrayObject):\n";
$obj = new ArrayObject(new ArrayObject(array('key'=>'nested ArrayObject element')));
$ao->exchangeArray($obj);
var_dump($ao['key']);
var_dump($ao);
?>
--EXPECTF--
--> exchangeArray(array):
string(8) "original"
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(1) {
["key"]=>
string(8) "original"
}
}
--> exchangeArray(normal object):
string(18) "normal object prop"
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
object(stdClass)#%d (1) {
["key"]=>
string(18) "normal object prop"
}
}
--> exchangeArray(ArrayObject):
string(19) "ArrayObject element"
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(1) {
["key"]=>
string(19) "ArrayObject element"
}
}
}
--> exchangeArray(ArrayIterator):
string(21) "ArrayIterator element"
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
object(ArrayIterator)#%d (1) {
["storage":"ArrayIterator":private]=>
array(1) {
["key"]=>
string(21) "ArrayIterator element"
}
}
}
--> exchangeArray(nested ArrayObject):
string(26) "nested ArrayObject element"
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(1) {
["key"]=>
string(26) "nested ArrayObject element"
}
}
}
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>