Skip to content

Commit 6b7d5ee

Browse files
authored
Merge pull request #50 from peter-gribanov/serializable-default
Serializable default
2 parents aab502b + 42dbbde commit 6b7d5ee

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/EnumTest.php

100644100755
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,26 @@ private function assertJsonEqualsJson($json1, $json2)
294294
{
295295
$this->assertJsonStringEqualsJsonString($json1, $json2);
296296
}
297+
298+
public function testSerialize()
299+
{
300+
// split string for Pretty CI: "Line exceeds 120 characters"
301+
$bin = '4f3a33303a224d79434c6162735c54657374735c456e756d5c456e756d4669787'.
302+
'4757265223a313a7b733a383a22002a0076616c7565223b733a333a22666f6f223b7d';
303+
304+
$this->assertEquals($bin, bin2hex(serialize(EnumFixture::FOO())));
305+
}
306+
307+
public function testUnserialize()
308+
{
309+
// split string for Pretty CI: "Line exceeds 120 characters"
310+
$bin = '4f3a33303a224d79434c6162735c54657374735c456e756d5c456e756d4669787'.
311+
'4757265223a313a7b733a383a22002a0076616c7565223b733a333a22666f6f223b7d';
312+
313+
/* @var $value EnumFixture */
314+
$value = unserialize(pack('H*', $bin));
315+
316+
$this->assertEquals(EnumFixture::FOO, $value->getValue());
317+
$this->assertTrue(EnumFixture::FOO()->equals($value));
318+
}
297319
}

0 commit comments

Comments
 (0)