Issue/329 refactor seeding (#337)
* Fix Contracts class names * Refactoring of the file seeds so it's not a mess * StyleCI fixes
This commit is contained in:
@@ -84,9 +84,7 @@ class ApiTest extends TestCase
|
||||
$airlines = factory(App\Models\Airline::class, $size)->create();
|
||||
|
||||
$res = $this->get('/api/airlines');
|
||||
$body = $res->json();
|
||||
|
||||
$this->assertCount($size, $body['data']);
|
||||
$this->assertTrue($res->isOk());
|
||||
|
||||
$airline = $airlines->random();
|
||||
$this->get('/api/airlines/'.$airline->id)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
use App\Models\UserAward;
|
||||
use App\Services\AwardService;
|
||||
use App\Services\PirepService;
|
||||
|
||||
class AwardsTest extends TestCase
|
||||
{
|
||||
@@ -10,8 +12,10 @@ class AwardsTest extends TestCase
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->awardSvc = app(\App\Services\AwardService::class);
|
||||
$this->pirepSvc = app(\App\Services\PirepService::class);
|
||||
$this->addData('base');
|
||||
$this->addData('fleet');
|
||||
$this->awardSvc = app(AwardService::class);
|
||||
$this->pirepSvc = app(PirepService::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ class FinanceTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
$this->addData('base');
|
||||
$this->addData('fleet');
|
||||
|
||||
$this->expenseRepo = app(ExpenseRepository::class);
|
||||
$this->fareSvc = app(FareService::class);
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Models\Pirep;
|
||||
use App\Models\User;
|
||||
use App\Repositories\SettingRepository;
|
||||
use App\Services\FlightService;
|
||||
use App\Services\PirepService;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class PIREPTest extends TestCase
|
||||
@@ -19,8 +20,9 @@ class PIREPTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
$this->addData('base');
|
||||
$this->addData('fleet');
|
||||
|
||||
$this->pirepSvc = app('App\Services\PirepService');
|
||||
$this->pirepSvc = app(PirepService::class);
|
||||
$this->settingsRepo = app(SettingRepository::class);
|
||||
}
|
||||
|
||||
@@ -195,7 +197,6 @@ class PIREPTest extends TestCase
|
||||
public function testPilotStatsIncr()
|
||||
{
|
||||
$user = factory(User::class)->create([
|
||||
'airline_id' => 1,
|
||||
'flights' => 0,
|
||||
'flight_time' => 0,
|
||||
'rank_id' => 1,
|
||||
@@ -203,8 +204,9 @@ class PIREPTest extends TestCase
|
||||
|
||||
// Submit two PIREPs
|
||||
$pireps = factory(Pirep::class, 2)->create([
|
||||
'airline_id' => 1,
|
||||
'user_id' => $user->id,
|
||||
'airline_id' => $user->airline_id,
|
||||
'aircraft_id' => 1,
|
||||
'user_id' => $user->id,
|
||||
// 360min == 6 hours, rank should bump up
|
||||
'flight_time' => 360,
|
||||
]);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#
|
||||
#airlines:
|
||||
# - id: 1
|
||||
# icao: VMS
|
||||
# iata: VM
|
||||
# name: phpvms airlines
|
||||
# active: 1
|
||||
# created_at: now
|
||||
# updated_at: now
|
||||
airlines:
|
||||
- id: 1
|
||||
icao: VMS
|
||||
iata: VM
|
||||
name: phpvms airlines
|
||||
active: 1
|
||||
created_at: now
|
||||
updated_at: now
|
||||
|
||||
users:
|
||||
- id: 1
|
||||
@@ -31,6 +31,12 @@ role_user:
|
||||
user_type: App\Models\User
|
||||
|
||||
ranks:
|
||||
- id: 1
|
||||
name: New Pilot
|
||||
hours: 0
|
||||
acars_base_pay_rate: 50
|
||||
manual_base_pay_rate: 25
|
||||
|
||||
- id: 2
|
||||
name: Junior First Officer
|
||||
hours: 10
|
||||
|
||||
60
tests/data/fleet.yml
Normal file
60
tests/data/fleet.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
subfleets:
|
||||
- id: 1
|
||||
airline_id: 1
|
||||
name: 747-43X RB211-524G
|
||||
type: 744-3X-RB211
|
||||
cost_block_hour: 1000
|
||||
ground_handling_multiplier: 200
|
||||
- id: 2
|
||||
airline_id: 1
|
||||
name: 777-222ER GE90-76B
|
||||
type: 772-22ER-GE90-76B
|
||||
cost_block_hour: 500
|
||||
ground_handling_multiplier: 150
|
||||
- id: 3
|
||||
airline_id: 1
|
||||
name: 777-367 ER GE90-115B
|
||||
type: 772-36ER-GE90-115B
|
||||
cost_block_hour: 100
|
||||
ground_handling_multiplier: 150
|
||||
|
||||
aircraft:
|
||||
- id: 1
|
||||
subfleet_id: 1
|
||||
airport_id: KJFK
|
||||
name: Boeing 747-438
|
||||
registration: 001Z
|
||||
status: A
|
||||
- id: 2
|
||||
subfleet_id: 2
|
||||
airport_id: LGRP
|
||||
name: Boeing 777-200
|
||||
registration: C202
|
||||
status: A
|
||||
- id: 3
|
||||
subfleet_id: 1
|
||||
airport_id: KAUS
|
||||
name: Boeing 747-412
|
||||
registration: S2333
|
||||
status: A
|
||||
- id: 4
|
||||
subfleet_id: 1
|
||||
airport_id: KAUS
|
||||
name: Boeing 747-436 RETIRED
|
||||
registration:
|
||||
status: R
|
||||
|
||||
subfleet_rank:
|
||||
- rank_id: 1
|
||||
subfleet_id: 1
|
||||
- rank_id: 1
|
||||
subfleet_id: 2
|
||||
- rank_id: 1
|
||||
subfleet_id: 3
|
||||
- rank_id: 2
|
||||
subfleet_id: 2
|
||||
- rank_id: 2
|
||||
subfleet_id: 3
|
||||
- rank_id: 3
|
||||
subfleet_id: 3
|
||||
Reference in New Issue
Block a user