Cleanup SI Unit classes and interface for REST responses; fixes to a few METAR parsing issues
This commit is contained in:
@@ -277,7 +277,7 @@ class AcarsTest extends TestCase
|
||||
$aircraft = $subfleet['aircraft']->random();
|
||||
|
||||
$uri = '/api/pireps/prefile';
|
||||
$pirep = [
|
||||
$pirep_create = [
|
||||
'airline_id' => $airline->id,
|
||||
'aircraft_id' => $aircraft->id,
|
||||
'dpt_airport_id' => $airport->icao,
|
||||
@@ -293,7 +293,7 @@ class AcarsTest extends TestCase
|
||||
],
|
||||
];
|
||||
|
||||
$response = $this->post($uri, $pirep);
|
||||
$response = $this->post($uri, $pirep_create);
|
||||
$response->assertStatus(201);
|
||||
|
||||
// Get the PIREP ID
|
||||
@@ -314,7 +314,7 @@ class AcarsTest extends TestCase
|
||||
*/
|
||||
$this->assertHasKeys($pirep, ['fields']);
|
||||
$this->assertEquals('custom_value', $pirep['fields']['custom_field']);
|
||||
|
||||
$this->assertEquals($pirep_create['planned_distance'], $pirep['planned_distance']['nmi']);
|
||||
$this->assertHasKeys($pirep['planned_distance'], ['mi', 'nmi', 'km']);
|
||||
|
||||
/**
|
||||
|
||||
@@ -466,7 +466,7 @@ class ImporterTest extends TestCase
|
||||
$this->assertEquals('0810 CST', $flight->dpt_time);
|
||||
$this->assertEquals('1235 EST', $flight->arr_time);
|
||||
$this->assertEquals('350', $flight->level);
|
||||
$this->assertEquals('1477', $flight->distance);
|
||||
$this->assertEquals(1477, $flight->distance['nmi']);
|
||||
$this->assertEquals('207', $flight->flight_time);
|
||||
$this->assertEquals(FlightType::SCHED_PAX, $flight->flight_type);
|
||||
$this->assertEquals('ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6', $flight->route);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Support\Math;
|
||||
use App\Support\Units\Distance;
|
||||
|
||||
class MathTest extends TestCase
|
||||
{
|
||||
@@ -26,4 +27,11 @@ class MathTest extends TestCase
|
||||
$this->assertEquals($test['expected'], $test['fn']);
|
||||
}
|
||||
}
|
||||
|
||||
public function testDistanceMeasurement()
|
||||
{
|
||||
$dist = new Distance(1, 'mi');
|
||||
$this->assertEquals(1609.34, $dist['m']);
|
||||
$this->assertEquals(1.61, $dist['km']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ class MetarTest extends TestCase
|
||||
$this->assertEquals('KJFK', $parsed['station']);
|
||||
$this->assertEquals(4, $parsed['observed_day']);
|
||||
$this->assertEquals('21:51 UTC', $parsed['observed_time']);
|
||||
$this->assertEquals(13.38, $parsed['wind_speed']);
|
||||
$this->assertEquals(20.06, $parsed['wind_gust_speed']);
|
||||
$this->assertEquals(26, $parsed['wind_speed']['knots']);
|
||||
$this->assertEquals(39, $parsed['wind_gust_speed']['knots']);
|
||||
$this->assertEquals(280, $parsed['wind_direction']);
|
||||
$this->assertEquals('W', $parsed['wind_direction_label']);
|
||||
$this->assertEquals(false, $parsed['wind_direction_varies']);
|
||||
@@ -72,8 +72,7 @@ class MetarTest extends TestCase
|
||||
$this->assertEquals(24.8, $parsed['dew_point']['f']);
|
||||
|
||||
$this->assertEquals(33, $parsed['humidity']);
|
||||
$this->assertEquals(29.58, $parsed['barometer']);
|
||||
$this->assertEquals(0.87, $parsed['barometer_in']);
|
||||
$this->assertEquals(29.58, $parsed['barometer']['hPa']);
|
||||
|
||||
$this->assertEquals('AO2 PK WND 27045/2128 PRESRR SLP018 T01221044', $parsed['remarks']);
|
||||
}
|
||||
@@ -121,7 +120,7 @@ class MetarTest extends TestCase
|
||||
$parsed = Metar::parse($metar);
|
||||
|
||||
$this->assertEquals('VFR', $parsed['category']);
|
||||
$this->assertEquals(9.26, $parsed['wind_speed']);
|
||||
$this->assertEquals(18, $parsed['wind_speed']['knots']);
|
||||
$this->assertEquals(8, $parsed['visibility']['mi']);
|
||||
$this->assertEquals(
|
||||
'Scattered at 4500 feet, cumulonimbus; broken sky at 6000 feet; overcast sky at 8000 feet',
|
||||
|
||||
Reference in New Issue
Block a user