You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
33
vendor/swoole/tests/swoole_serialize/006.phpt
vendored
Executable file
33
vendor/swoole/tests/swoole_serialize/006.phpt
vendored
Executable file
@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
swoole_serialize: Check for simple string serialization
|
||||
--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) {
|
||||
$serialized = swoole_serialize::pack($variable);
|
||||
$unserialized = swoole_serialize::unpack($serialized);
|
||||
|
||||
echo $type, PHP_EOL;
|
||||
var_dump($unserialized);
|
||||
echo $unserialized === $variable ? 'OK' : 'ERROR', PHP_EOL;
|
||||
}
|
||||
|
||||
test('empty: ""', "");
|
||||
test('string: "foobar"', "foobar");
|
||||
?>
|
||||
--EXPECT--
|
||||
empty: ""
|
||||
string(0) ""
|
||||
OK
|
||||
string: "foobar"
|
||||
string(6) "foobar"
|
||||
OK
|
Reference in New Issue
Block a user