Laravel 9 Update (#1413)

Update to Laravel 9 and PHP 8+

Co-authored-by: B.Fatih KOZ <fatih.koz@gmail.com>
This commit is contained in:
Nabeel S
2022-03-14 11:45:18 -04:00
committed by GitHub
parent 00bf18c225
commit 12848091a2
340 changed files with 6130 additions and 4502 deletions

View File

@@ -4,6 +4,7 @@ namespace Tests;
use App\Repositories\KvpRepository;
use App\Support\ICAO;
use App\Support\Units\Distance;
use App\Support\Units\Time;
use App\Support\Utils;
use Carbon\Carbon;
@@ -16,6 +17,51 @@ class UtilsTest extends TestCase
$this->assertNotNull($carbon);
}
/**
* @throws \PhpUnitsOfMeasure\Exception\NonNumericValue
* @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName
*/
public function testUnitRounding()
{
$this->updateSetting('units.distance', 'km');
$alt = new Distance(1065.3456, 'nmi');
$km = $alt->toUnit('km');
$this->assertEquals(1973.0200512, $km);
$km = $alt->toUnit('km', 2);
$this->assertEquals(1973.02, $km);
$km = $alt->toUnit('km', 0);
$this->assertEquals(1973, $km);
/*
* Test local conversions
*/
$km = $alt->local();
$this->assertEquals(1973.0200512, $km);
$km = $alt->local(0);
$this->assertEquals(1973, $km);
$km = $alt->local(2);
$this->assertEquals(1973.02, $km);
/*
* Internal units, shouldn't do a conversion
*/
$int = $alt->internal();
$this->assertEquals(1065.3456, $int);
$int = $alt->internal(2);
$this->assertEquals(1065.35, $int);
$int = $alt->internal(0);
$this->assertEquals(1065, $int);
}
/**
* Simple test for KVP
*/