New tests (and ordering of tests)

This commit is contained in:
Marcus Boerger 2004-04-13 19:06:39 +00:00
parent ad2471cbbb
commit f0c91bac50
5 changed files with 86 additions and 0 deletions

37
ext/spl/tests/array_002.phpt Executable file
View File

@ -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===

49
ext/spl/tests/array_003.phpt Executable file
View File

@ -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===