Save airport timezone (#1112)

* Fix airport timezone lookup

* Save timezone to the airport when importing
This commit is contained in:
Nabeel S
2021-03-29 15:49:34 -04:00
committed by GitHub
parent 9c4aced837
commit 96fff0248d
4 changed files with 43 additions and 2 deletions

30
tests/AirportTest.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace Tests;
use App\Models\Airport;
/**
* Test the parsing/support class of the metar
*/
class AirportTest extends TestCase
{
public function testSavingAirportFromApiResponse()
{
// This is the response from the API
$airportResponse = [
'icao' => 'KJFK',
'iata' => 'JFK',
'name' => 'John F Kennedy International Airport',
'city' => 'New York',
'country' => 'United States',
'tz' => 'America/New_York',
'lat' => 40.63980103,
'lon' => -73.77890015,
];
$airport = new Airport($airportResponse);
$this->assertEquals($airportResponse['icao'], $airport->icao);
$this->assertEquals($airportResponse['tz'], $airport->timezone);
}
}