File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / spl / tests / arrayObject___construct_basic1.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::__construct basic usage.
--FILE--
<?php
echo "--> No arguments:\n";
var_dump(new ArrayObject());

echo "--> Object argument:\n";
$a = new stdClass;
$a->p = 'hello';
var_dump(new ArrayObject($a));

echo "--> Array argument:\n";
var_dump(new ArrayObject(array('key1' => 'val1')));

echo "--> Nested ArrayObject argument:\n";
var_dump(new ArrayObject(new ArrayObject($a)));
?>
--EXPECTF--
--> No arguments:
object(ArrayObject)#1 (1) {
  ["storage":"ArrayObject":private]=>
  array(0) {
  }
}
--> Object argument:
object(ArrayObject)#2 (1) {
  ["storage":"ArrayObject":private]=>
  object(stdClass)#1 (1) {
    ["p"]=>
    string(5) "hello"
  }
}
--> Array argument:
object(ArrayObject)#2 (1) {
  ["storage":"ArrayObject":private]=>
  array(1) {
    ["key1"]=>
    string(4) "val1"
  }
}
--> Nested ArrayObject argument:
object(ArrayObject)#2 (1) {
  ["storage":"ArrayObject":private]=>
  object(ArrayObject)#3 (1) {
    ["storage":"ArrayObject":private]=>
    object(stdClass)#1 (1) {
      ["p"]=>
      string(5) "hello"
    }
  }
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>