Add some indexes and tests for airports
This commit is contained in:
@@ -22,6 +22,10 @@ class CreateAirportsTable extends Migration
|
||||
$table->unsignedDecimal('fuel_mogas_cost')->nullable()->default(0);
|
||||
$table->float('lat', 7, 4)->nullable()->default(0.0);
|
||||
$table->float('lon', 7, 4)->nullable()->default(0.0);
|
||||
|
||||
$table->index('icao');
|
||||
$table->index('iata');
|
||||
$table->index('hub');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -569,7 +569,7 @@ class ImporterTest extends TestCase
|
||||
$file_path = base_path('tests/data/airports.csv');
|
||||
$status = $this->importSvc->importAirports($file_path);
|
||||
|
||||
$this->assertCount(1, $status['success']);
|
||||
$this->assertCount(2, $status['success']);
|
||||
$this->assertCount(1, $status['errors']);
|
||||
|
||||
// See if it imported
|
||||
@@ -588,6 +588,14 @@ class ImporterTest extends TestCase
|
||||
$this->assertEquals(true, $airport->hub);
|
||||
$this->assertEquals('30.1945', $airport->lat);
|
||||
$this->assertEquals('-97.6699', $airport->lon);
|
||||
|
||||
// See if it imported
|
||||
$airport = \App\Models\Airport::where([
|
||||
'id' => 'KSFO',
|
||||
])->first();
|
||||
|
||||
$this->assertNotNull($airport);
|
||||
$this->assertEquals(true, $airport->hub);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
icao,iata,name,location,country,timezone,hub,lat,lon
|
||||
KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA", United States,America/Chicago,1,30.1945,-97.6699
|
||||
KJFK,JFK,Kennery,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd
|
||||
KSFO,SFO,San Francisco,"San Francisco, California, USA", United States,America/California,"1",30.1945,-97.6699
|
||||
KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd
|
||||
|
||||
|
Reference in New Issue
Block a user