From 2ffbb62b79f44f9c3c6f07694d6241ec58071743 Mon Sep 17 00:00:00 2001 From: Abdelhamid Benmeziane Date: Mon, 30 Nov 2020 17:05:12 +0100 Subject: [PATCH] add test for empty case in JSON serializer Signed-off-by: Abdelhamid Benmeziane --- .../Serializers/EverythingToJSONSerializerTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php b/tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php index 7522cac7a..75a433cc0 100644 --- a/tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php +++ b/tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php @@ -18,6 +18,7 @@ namespace Elasticsearch\Tests\Serializers; +use Elasticsearch\Common\Exceptions\RuntimeException; use Elasticsearch\Serializers\EverythingToJSONSerializer; use Mockery as m; @@ -43,6 +44,17 @@ public function testSerializeArray() $this->assertSame($body, $ret); } + public function testSerializeArrayEmpty() + { + $serializer = new EverythingToJSONSerializer(); + $data = []; + + $ret = $serializer->serialize($data); + + $this->assertSame('{}', $ret); + + } + public function testSerializeString() { $serializer = new EverythingToJSONSerializer(); @@ -54,6 +66,8 @@ public function testSerializeString() $this->assertSame($body, $ret); } + + public function testDeserializeJSON() { $serializer = new EverythingToJSONSerializer();