File: enum001.phpt

package info (click to toggle)
php-msgpack 1%3A3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,224 kB
  • sloc: ansic: 3,925; xml: 458; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 467 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--TEST--
Enums
--SKIPIF--
<?php
if (!extension_loaded("msgpack")) {
    exit('skip because msgpack extension is missing');
}
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
    exit('skip Enum tests in PHP older than 8.1.0');
}
?>
--FILE--
<?php
echo "Test\n";
enum Enum {
    case A;
    case B;
    case C;
}
$a = [Enum::A,Enum::B,Enum::C];
$b = msgpack_unpack(msgpack_pack([Enum::A,Enum::B,Enum::C]));
var_dump($a == $b);
?>
DONE
--EXPECT--
Test
bool(true)
DONE