Bids are missing subfleets in API response #867 (#868)

Bids are missing subfleets in API response #867
This commit is contained in:
Nabeel S
2020-10-12 12:49:11 -04:00
committed by GitHub
parent 193fbd369d
commit dc007f6d9e
7 changed files with 100 additions and 23 deletions

View File

@@ -4,9 +4,30 @@ namespace Tests;
use App\Models\Aircraft;
use App\Models\Subfleet;
use App\Models\User;
use Exception;
trait TestData
{
/**
* @param array $attrs Additional user attributes
*
* @throws Exception
*
* @return User
*/
public function createUser(array $attrs = []): User
{
$subfleet = $this->createSubfleetWithAircraft(1);
$rank = $this->createRank(2, [$subfleet['subfleet']->id]);
$user = factory(User::class)->create(array_merge([
'flight_time' => 1000,
'rank_id' => $rank->id,
], $attrs));
return $user;
}
/**
* Create a new PIREP with a proper subfleet/rank/user and an
* aircraft that the user is allowed to fly
@@ -37,7 +58,7 @@ trait TestData
*
* @return mixed
*/
public function createRank($hours, array $subfleet_ids)
public function createRank(int $hours, array $subfleet_ids)
{
$attrs = [];
@@ -59,12 +80,13 @@ trait TestData
* @param null $aircraft_count
* @param null $airport_id
*
* @throws \Exception
* @throws Exception
*
* @return mixed
*/
public function createSubfleetWithAircraft($aircraft_count = null, $airport_id = null)
{
/** @var Subfleet $subfleet */
$subfleet = factory(Subfleet::class)->create([
'ground_handling_multiplier' => '100',
]);