Add days of week to flights table; add to import/export for flights
This commit is contained in:
@@ -230,6 +230,10 @@ class ImporterTest extends TestCase
|
||||
|
||||
$flight = factory(App\Models\Flight::class)->create([
|
||||
'airline_id' => $airline->id,
|
||||
'days' => \App\Models\Enums\Days::getDaysMask([
|
||||
\App\Models\Enums\Days::TUESDAY,
|
||||
\App\Models\Enums\Days::SUNDAY,
|
||||
]),
|
||||
]);
|
||||
|
||||
$flight->subfleets()->syncWithoutDetaching([$subfleet->id, $subfleet2->id]);
|
||||
@@ -256,6 +260,7 @@ class ImporterTest extends TestCase
|
||||
$exporter = new \App\Services\ImportExport\FlightExporter();
|
||||
$exported = $exporter->export($flight);
|
||||
|
||||
$this->assertEquals('27', $exported['days']);
|
||||
$this->assertEquals('VMS', $exported['airline']);
|
||||
$this->assertEquals('A32X;B74X', $exported['subfleets']);
|
||||
$this->assertEquals('Y?capacity=100;F', $exported['fares']);
|
||||
@@ -376,6 +381,11 @@ class ImporterTest extends TestCase
|
||||
$this->assertEquals('Just a flight', $flight->notes);
|
||||
$this->assertEquals(true, $flight->active);
|
||||
|
||||
# Test that the days were set properly
|
||||
$this->assertTrue($flight->on_day(\App\Models\Enums\Days::MONDAY));
|
||||
$this->assertTrue($flight->on_day(\App\Models\Enums\Days::FRIDAY));
|
||||
$this->assertFalse($flight->on_day(\App\Models\Enums\Days::TUESDAY));
|
||||
|
||||
// Check the custom fields entered
|
||||
$fields = \App\Models\FlightFieldValue::where([
|
||||
'flight_id' => $flight->id,
|
||||
|
||||
Reference in New Issue
Block a user