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:
@@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user