From 15bcceec71a56b605af27293ea3d7cc6567dff51 Mon Sep 17 00:00:00 2001 From: Maxim Kott Date: Wed, 24 May 2017 16:01:25 +0200 Subject: [PATCH] Add additional tests --- tests/Weew/JsonEncoder/JsonEncoderTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Weew/JsonEncoder/JsonEncoderTest.php b/tests/Weew/JsonEncoder/JsonEncoderTest.php index acabf2b..88b7803 100644 --- a/tests/Weew/JsonEncoder/JsonEncoderTest.php +++ b/tests/Weew/JsonEncoder/JsonEncoderTest.php @@ -61,4 +61,15 @@ public function test_decode_throws_exception_with_invalid_data() { $this->setExpectedException(JsonDecodeException::class); $encoder->decode('{"foo": "bar"'); } + + public function test_encode_null() { + $encoder = new JsonEncoder(); + $this->setExpectedException(InvalidDataTypeException::class); + $encoder->encode(null); + } + + public function test_decode_null() { + $encoder = new JsonEncoder(); + $this->assertEquals(null, $encoder->decode(null)); + } }