diff --git a/tests/Util/UnitTest.php b/tests/Util/UnitTest.php index 358ffdd..c03d09f 100644 --- a/tests/Util/UnitTest.php +++ b/tests/Util/UnitTest.php @@ -167,4 +167,10 @@ public function testToString() $this->assertEquals($this->unit->getFormatted(), $this->unit); } + + public function testToJSON() + { + $unit = new Unit(42.5, "°C", "hot", "2.5"); + $this->assertEquals(json_encode($unit), '{"value":42.5,"unit":"\u00b0C","description":"hot","precision":2.5}'); + } }