You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
52
vendor/swoole/tests/swoole_serialize/010.phpt
vendored
Executable file
52
vendor/swoole/tests/swoole_serialize/010.phpt
vendored
Executable file
@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
swoole_serialize: Array test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require __DIR__ . '/../include/skipif.inc';
|
||||
if (!class_exists("swoole_serialize", false))
|
||||
{
|
||||
echo "skip";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/../include/bootstrap.php';
|
||||
|
||||
function test($type, $variable, $test) {
|
||||
$serialized = swoole_serialize::pack($variable);
|
||||
$unserialized = swoole_serialize::unpack($serialized);
|
||||
|
||||
echo $type, PHP_EOL;
|
||||
var_dump($unserialized);
|
||||
echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
|
||||
}
|
||||
|
||||
$a = array(
|
||||
'a' => array(
|
||||
'b' => 'c',
|
||||
'd' => 'e'
|
||||
),
|
||||
'f' => array(
|
||||
'g' => 'h'
|
||||
)
|
||||
);
|
||||
|
||||
test('array', $a, false);
|
||||
?>
|
||||
--EXPECT--
|
||||
array
|
||||
array(2) {
|
||||
["a"]=>
|
||||
array(2) {
|
||||
["b"]=>
|
||||
string(1) "c"
|
||||
["d"]=>
|
||||
string(1) "e"
|
||||
}
|
||||
["f"]=>
|
||||
array(1) {
|
||||
["g"]=>
|
||||
string(1) "h"
|
||||
}
|
||||
}
|
||||
OK
|
Reference in New Issue
Block a user