Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmfcmf committed Mar 13, 2020
1 parent bfe7533 commit f9e2bae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/Util/UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
}
}

0 comments on commit f9e2bae

Please sign in to comment.