Skip to content

Commit f9e2bae

Browse files
committedMar 13, 2020
Add test
1 parent bfe7533 commit f9e2bae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎tests/Util/UnitTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,10 @@ public function testToString()
167167

168168
$this->assertEquals($this->unit->getFormatted(), $this->unit);
169169
}
170+
171+
public function testToJSON()
172+
{
173+
$unit = new Unit(42.5, "°C", "hot", "2.5");
174+
$this->assertEquals(json_encode($unit), '{"value":42.5,"unit":"\u00b0C","description":"hot","precision":2.5}');
175+
}
170176
}

0 commit comments

Comments
 (0)
Please sign in to comment.