Apply fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
20f46adbc4
commit
9596d88b48
@@ -1,7 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Tests;
|
||||
|
||||
@@ -10,6 +7,7 @@ trait TestData
|
||||
/**
|
||||
* Create a new PIREP with a proper subfleet/rank/user and an
|
||||
* aircraft that the user is allowed to fly
|
||||
*
|
||||
* @return \App\Models\Pirep
|
||||
*/
|
||||
protected function createPirep()
|
||||
@@ -17,12 +15,12 @@ trait TestData
|
||||
$subfleet = $this->createSubfleetWithAircraft(2);
|
||||
$rank = $this->createRank(10, [$subfleet['subfleet']->id]);
|
||||
$this->user = factory(\App\Models\User::class)->create([
|
||||
'rank_id' => $rank->id
|
||||
'rank_id' => $rank->id,
|
||||
]);
|
||||
|
||||
// Return a Pirep model
|
||||
$pirep = factory(\App\Models\Pirep::class)->make([
|
||||
'aircraft_id' => $subfleet['aircraft']->random()->id
|
||||
'aircraft_id' => $subfleet['aircraft']->random()->id,
|
||||
]);
|
||||
|
||||
return $pirep;
|
||||
@@ -30,20 +28,22 @@ trait TestData
|
||||
|
||||
/**
|
||||
* Create a rank and associate the given subfleet IDs with it
|
||||
* @param int $hours
|
||||
*
|
||||
* @param int $hours
|
||||
* @param array $subfleet_ids
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function createRank($hours=0, array $subfleet_ids)
|
||||
public function createRank($hours, array $subfleet_ids)
|
||||
{
|
||||
$attrs = [];
|
||||
|
||||
if($hours === null) {
|
||||
if ($hours === null) {
|
||||
$attrs['hours'] = $hours;
|
||||
}
|
||||
|
||||
$rank = factory(\App\Models\Rank::class)->create($attrs);
|
||||
if(!empty($subfleet_ids)) {
|
||||
if (!empty($subfleet_ids)) {
|
||||
$rank->subfleets()->syncWithoutDetaching($subfleet_ids);
|
||||
}
|
||||
|
||||
@@ -52,23 +52,25 @@ trait TestData
|
||||
|
||||
/**
|
||||
* Create a subfleet with a number of aircraft assigned
|
||||
*
|
||||
* @param null $aircraft_count
|
||||
* @param null $airport_id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function createSubfleetWithAircraft($aircraft_count = null, $airport_id=null)
|
||||
public function createSubfleetWithAircraft($aircraft_count = null, $airport_id = null)
|
||||
{
|
||||
$subfleet = factory(\App\Models\Subfleet::class)->create([
|
||||
'ground_handling_multiplier' => '100',
|
||||
]);
|
||||
|
||||
if($aircraft_count === null) {
|
||||
if ($aircraft_count === null) {
|
||||
$aircraft_count = \random_int(2, 10);
|
||||
}
|
||||
|
||||
$aircraft = factory(\App\Models\Aircraft::class, $aircraft_count)->create([
|
||||
'subfleet_id' => $subfleet->id,
|
||||
'airport_id' => $airport_id,
|
||||
'airport_id' => $airport_id,
|
||||
]);
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user