@@ -435,7 +435,9 @@ class FinanceTest extends TestCase
|
||||
// Change to a percentage
|
||||
$manual_pay_rate = '50%';
|
||||
$manual_pay_adjusted = Math::addPercent(
|
||||
$rank->manual_base_pay_rate, $manual_pay_rate);
|
||||
$rank->manual_base_pay_rate,
|
||||
$manual_pay_rate
|
||||
);
|
||||
|
||||
$this->fleetSvc->addSubfleetToRank($subfleet['subfleet'], $rank, [
|
||||
'manual_pay' => $manual_pay_rate,
|
||||
|
||||
@@ -27,15 +27,18 @@ class FlightTest extends TestCase
|
||||
/**
|
||||
* Add a single flight
|
||||
*
|
||||
* @param $user
|
||||
* @param $user
|
||||
* @param array $flight_properties
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function addFlight($user)
|
||||
public function addFlight($user, $flight_properties = [])
|
||||
{
|
||||
$flight = factory(App\Models\Flight::class)->create([
|
||||
$opts = array_merge([
|
||||
'airline_id' => $user->airline_id,
|
||||
]);
|
||||
], $flight_properties);
|
||||
|
||||
$flight = factory(App\Models\Flight::class)->create($opts);
|
||||
|
||||
$flight->subfleets()->syncWithoutDetaching([
|
||||
factory(App\Models\Subfleet::class)->create([
|
||||
@@ -119,7 +122,10 @@ class FlightTest extends TestCase
|
||||
public function testGetFlight()
|
||||
{
|
||||
$this->user = factory(App\Models\User::class)->create();
|
||||
$flight = $this->addFlight($this->user);
|
||||
$flight = $this->addFlight($this->user, [
|
||||
'load_factor' => '',
|
||||
'load_factor_variance' => '',
|
||||
]);
|
||||
|
||||
$req = $this->get('/api/flights/'.$flight->id);
|
||||
$req->assertStatus(200);
|
||||
@@ -128,6 +134,7 @@ class FlightTest extends TestCase
|
||||
$this->assertEquals($flight->id, $body['id']);
|
||||
$this->assertEquals($flight->dpt_airport_id, $body['dpt_airport_id']);
|
||||
$this->assertEquals($flight->arr_airport_id, $body['arr_airport_id']);
|
||||
$this->assertEquals(setting('flights.default_load_factor'), $body['load_factor']);
|
||||
|
||||
// Distance conversion
|
||||
$this->assertHasKeys($body['distance'], ['mi', 'nmi', 'km']);
|
||||
@@ -167,6 +174,12 @@ class FlightTest extends TestCase
|
||||
$flight->route = $route_text;
|
||||
$flight->save();
|
||||
|
||||
$req = $this->get('/api/flights/'.$flight->id);
|
||||
$req->assertStatus(200);
|
||||
|
||||
$body = $req->json()['data'];
|
||||
$this->assertEquals($flight->load_factor, $body['load_factor']);
|
||||
|
||||
$res = $this->get('/api/flights/'.$flight->id.'/route');
|
||||
$res->assertStatus(200);
|
||||
$body = $res->json();
|
||||
|
||||
@@ -27,7 +27,8 @@ class MetarTest extends TestCase
|
||||
private function mockXmlResponse($filename)
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
new Response(200,
|
||||
new Response(
|
||||
200,
|
||||
[
|
||||
'Content-Type' => 'text/xml',
|
||||
],
|
||||
@@ -85,7 +86,8 @@ class MetarTest extends TestCase
|
||||
$this->assertCount(4, $parsed['clouds']);
|
||||
$this->assertEquals(
|
||||
'A few at 1676 meters; scattered at 2896 meters; broken sky at 3353 meters; broken sky at 7010 meters',
|
||||
$parsed['clouds_report']);
|
||||
$parsed['clouds_report']
|
||||
);
|
||||
$this->assertEquals(1676.4, $parsed['cloud_height']['m']);
|
||||
$this->assertEquals(false, $parsed['cavok']);
|
||||
|
||||
|
||||
@@ -135,7 +135,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
public function mockGuzzleClient($mockFile): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
new Response(200,
|
||||
new Response(
|
||||
200,
|
||||
[
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
airline,name,amount,type,charge_to_user,multiplier,active,ref_model,ref_model_id
|
||||
,"Per-Flight (no muliplier)",100,F,0,0,1,,
|
||||
,"Per-Flight (multiplier)",100,F,0,1,1,,
|
||||
VMS,"Per-Flight (multiplier, on airline)",200,F,0,1,1,,
|
||||
,"A daily fee",800,D,0,0,1,,
|
||||
,"A monthly fee",5000,M,0,0,1,,
|
||||
,Catering,1000,F,0,0,1,Subfleet,744-3X-RB211
|
||||
,"Catering Staff",1000,D,0,0,1,Subfleet,744-3X-RB211
|
||||
,Maintenance,1000,D,0,0,1,App\Models\Aircraft,001Z
|
||||
airline,name,amount,type,flight_type,charge_to_user,multiplier,active,ref_model,ref_model_id
|
||||
,"Per-Flight (no muliplier)",100,F,,0,0,1,,
|
||||
,"Per-Flight (multiplier)",100,F,,0,1,1,,
|
||||
VMS,"Per-Flight (multiplier, on airline)",200,F,,0,1,1,,
|
||||
,"A daily fee",800,D,,0,0,1,,
|
||||
,"A monthly fee",5000,M,,0,0,1,,
|
||||
,Catering,1000,F,J,0,0,1,Subfleet,744-3X-RB211
|
||||
,"Catering Staff",1000,D,J,0,0,1,Subfleet,744-3X-RB211
|
||||
,Maintenance,1000,D,F,0,0,1,App\Models\Aircraft,001Z
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
airline,name,amount,type,charge_to_user,multiplier,active,ref_model,ref_model_id
|
||||
,"Per-Flight (no muliplier)",100,F,0,0,1,,
|
||||
,"Per-Flight (multiplier)",100,F,0,1,1,,
|
||||
VMS,"Per-Flight (multiplier, on airline)",200,F,0,1,1,,
|
||||
,"A daily fee",800,D,0,0,1,,
|
||||
,"A monthly fee",5000,M,0,0,1,,
|
||||
,Catering,1000,F,0,0,1,Subfleet,744-3X-RB211
|
||||
,"Catering Staff",1000,D,0,0,1,Subfleet,744-3X-RB211
|
||||
,Maintenance,1000,D,0,0,1,App\Models\Aircraft,001Z
|
||||
airline,name,amount,type,flight_type,charge_to_user,multiplier,active,ref_model,ref_model_id
|
||||
,"Per-Flight (no muliplier)",100,F,,0,0,1,,
|
||||
,"Per-Flight (multiplier)",100,F,,0,1,1,,
|
||||
VMS,"Per-Flight (multiplier, on airline)",200,F,,0,1,1,,
|
||||
,"A daily fee",800,D,,0,0,1,,
|
||||
,"A monthly fee",5000,M,,0,0,1,,
|
||||
,Catering,1000,F,,0,0,1,Subfleet,744-3X-RB211
|
||||
,"Catering Staff",1000,D,,0,0,1,Subfleet,744-3X-RB211
|
||||
,Maintenance,1000,D,,0,0,1,App\Models\Aircraft,001Z
|
||||
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,route,notes,active,subfleets,fares,fields
|
||||
VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41
|
||||
" ",1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41
|
||||
VMS,113,,,KJFK,KAUS,KDFW,15,0810 EST,1035 CST,350,,207,J,,"Empty distance",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=C41;Arrival Gate=2
|
||||
airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,load_factor, load_factor_variance,route,notes,active,subfleets,fares,fields
|
||||
VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,85,0, ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41
|
||||
" ",1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,100,10, ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=4;Arrival Gate=C41
|
||||
VMS,113,,,KJFK,KAUS,KDFW,15,0810 EST,1035 CST,350,,207,J,70,2,,"Empty distance",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,Departure Gate=C41;Arrival Gate=2
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,route,notes,active,subfleets,fares,fields
|
||||
VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,
|
||||
airline,flight_number,route_code,route_leg,dpt_airport,arr_airport,alt_airport,days,dpt_time,arr_time,level,distance,flight_time,flight_type,load_factor, load_factor_variance,route,notes,active,subfleets,fares,fields
|
||||
VMS,1972,,,KAUS,KJFK,KLGA,15,0810 CST,1235 EST,350,1477,207,J,,,ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6,"Just a flight",1,A32X,Y?price=300&cost=100&capacity=130;F?price=600&cost=400;B?,
|
||||
|
||||
|
Reference in New Issue
Block a user