From f815863f4c3439cc11b603561f019cb3b34980af Mon Sep 17 00:00:00 2001 From: Serhii Polishchuk Date: Mon, 24 Jul 2023 12:05:14 +0200 Subject: [PATCH] Reveal issue with floats by tests --- Tests/JsonResponseTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/JsonResponseTest.php b/Tests/JsonResponseTest.php index e5443c0b8..a779a5f40 100644 --- a/Tests/JsonResponseTest.php +++ b/Tests/JsonResponseTest.php @@ -190,6 +190,12 @@ public function testConstructorWithObjectWithoutToStringMethodThrowsAnException( new JsonResponse(new \stdClass(), 200, [], true); } + + public function testFloatNumbers() + { + $response = new JsonResponse(['data' => 1.0]); + $this->assertEquals('{"data":1.0}', $response->getContent()); + } } class JsonSerializableObject implements \JsonSerializable