Make sure arr_airport and dep_airport are included in PIREP prefile response #120

This commit is contained in:
Nabeel Shahzad 2018-01-04 21:21:51 -06:00
parent c43eef6be2
commit dd629b2af8
2 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,13 @@ class Pirep extends Resource
*/
public function toArray($request)
{
return parent::toArray($request);
$pirep = parent::toArray($request);
$pirep['airline'] = new Airline($this->airline);
$pirep['dpt_airport'] = new Airport($this->dpt_airport);
$pirep['arr_airport'] = new Airport($this->arr_airport);
$pirep['position'] = new Acars($this->position);
return $pirep;
}
}

View File

@ -82,7 +82,10 @@ class AcarsTest extends TestCase
$response->assertStatus(201);
# Get the PIREP ID
$pirep_id = $response->json()['id'];
$body = $response->json();
$pirep_id = $body['id'];
$this->assertHasKeys($body, ['airline', 'arr_airport', 'dpt_airport', 'position']);
$this->assertNotNull($pirep_id);
# Check the PIREP state and status