]> granicus.if.org Git - php/commitdiff
New tests (and ordering of tests)
authorMarcus Boerger <helly@php.net>
Tue, 13 Apr 2004 19:06:39 +0000 (19:06 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 13 Apr 2004 19:06:39 +0000 (19:06 +0000)
ext/spl/tests/array_001.phpt [moved from ext/spl/tests/array_object.phpt with 100% similarity]
ext/spl/tests/array_002.phpt [new file with mode: 0755]
ext/spl/tests/array_003.phpt [new file with mode: 0755]
ext/spl/tests/array_004.phpt [moved from ext/spl/tests/array_iterator.phpt with 100% similarity]
ext/spl/tests/array_005.phpt [moved from ext/spl/tests/array_object_iterator.phpt with 100% similarity]

diff --git a/ext/spl/tests/array_002.phpt b/ext/spl/tests/array_002.phpt
new file mode 100755 (executable)
index 0000000..960253f
--- /dev/null
@@ -0,0 +1,37 @@
+--TEST--
+SPL: ArrayObject copy constructor
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+
+$array = array('1' => 'one',
+               '2' => 'two',
+               '3' => 'three');
+
+$object = new ArrayObject($array);
+$object[] = 'four';
+
+$arrayObject = new ArrayObject($object);
+
+$arrayObject[] = 'five';
+
+var_dump($arrayObject);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+object(ArrayObject)#%d (5) {
+  [1]=>
+  string(3) "one"
+  [2]=>
+  string(3) "two"
+  [3]=>
+  string(5) "three"
+  [4]=>
+  string(4) "four"
+  [5]=>
+  string(4) "five"
+}
+===DONE===
diff --git a/ext/spl/tests/array_003.phpt b/ext/spl/tests/array_003.phpt
new file mode 100755 (executable)
index 0000000..b7de6a7
--- /dev/null
@@ -0,0 +1,49 @@
+--TEST--
+SPL: ArrayObject from object
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+
+class test
+{
+       public    $pub = "public";
+       protected $pro = "protected";
+       private   $pri = "private";
+       
+       function __construct()
+       {
+               $this->imp = "implicit";
+       }
+};
+
+$test = new test;
+$test->dyn = "dynamic";
+
+print_r($test);
+
+$object = new ArrayObject($test);
+
+print_r($object);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+test Object
+(
+    [pub] => public
+    [pro:protected] => protected
+    [pri:private] => private
+    [imp] => implicit
+    [dyn] => dynamic
+)
+ArrayObject Object
+(
+    [pub] => public
+    [pro:protected] => protected
+    [pri:private] => private
+    [imp] => implicit
+    [dyn] => dynamic
+)
+===DONE===