2018-10-05 06:26:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Unit;
|
|
|
|
|
2018-10-05 09:51:37 +02:00
|
|
|
use App\Utils\NumberHelper;
|
2018-10-05 06:26:05 +02:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
2018-10-08 11:38:45 +02:00
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
* @covers App\Utils\NumberHelper
|
|
|
|
*/
|
2018-10-05 06:26:05 +02:00
|
|
|
class NumberTest extends TestCase
|
|
|
|
{
|
2018-10-17 14:26:27 +02:00
|
|
|
|
|
|
|
|
2018-10-05 06:26:05 +02:00
|
|
|
public function testRoundingThreeLow()
|
|
|
|
{
|
|
|
|
$rounded = NumberHelper::roundValue(3.144444444444, 3);
|
|
|
|
|
|
|
|
$this->assertEquals(3.144, $rounded);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testRoundingThreeHigh()
|
|
|
|
{
|
|
|
|
$rounded = NumberHelper::roundValue(3.144944444444, 3);
|
|
|
|
|
|
|
|
$this->assertEquals(3.145, $rounded);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testRoundingTwoLow()
|
|
|
|
{
|
|
|
|
$rounded = NumberHelper::roundValue(2.145);
|
|
|
|
|
|
|
|
$this->assertEquals(2.15, $rounded);
|
|
|
|
}
|
|
|
|
}
|