mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
New tests (and ordering of tests)
This commit is contained in:
parent
ad2471cbbb
commit
f0c91bac50
37
ext/spl/tests/array_002.phpt
Executable file
37
ext/spl/tests/array_002.phpt
Executable 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
49
ext/spl/tests/array_003.phpt
Executable 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===
|
Loading…
Reference in New Issue
Block a user