Skip to content

Commit

Permalink
add test for empty case in JSON serializer
Browse files Browse the repository at this point in the history
Signed-off-by: Abdel Benmeziane <[email protected]>
  • Loading branch information
Abdelhamid Benmeziane authored and ahmidbbc committed Dec 4, 2020
1 parent dfd2b62 commit b99561f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace Elasticsearch\Tests\Serializers;

use Elasticsearch\Common\Exceptions\RuntimeException;
use Elasticsearch\Serializers\EverythingToJSONSerializer;
use Mockery as m;

Expand All @@ -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();
Expand All @@ -54,6 +66,8 @@ public function testSerializeString()
$this->assertSame($body, $ret);
}



public function testDeserializeJSON()
{
$serializer = new EverythingToJSONSerializer();
Expand Down

0 comments on commit b99561f

Please sign in to comment.