1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-07 21:56:33 +02:00

feat(tests): improve tests for serializers

This commit is contained in:
Awilum
2021-09-28 22:52:58 +03:00
parent b81a9ff4b7
commit 5bafa6731c

View File

@@ -9,6 +9,10 @@ test('encode', function () {
$this->assertEquals(47, strings(serializers()->phpcode()->encode(['flextype' => registry()->get("flextype.manifest.version")]))->length());
});
test('test encode() throws exception RuntimeException', function (): void {
serializers()->phpcode()->encode(new Foo());
})->throws(RuntimeException::class);
test('decode', function () {
$this->assertEquals('Flextype', serializers()->phpcode()->decode('registry()->get("flextype.manifest.name")'));
});
@@ -19,4 +23,12 @@ test('get cache ID', function () {
->getCacheID($string);
$this->assertEquals(32, strlen($cache_id));
$this->assertNotEquals($string, $cache_id);
});
});
class Foo
{
public function __serialize()
{
throw new RuntimeException();
}
}