Add pirep comments and subfleets fares #118

This commit is contained in:
Nabeel Shahzad
2018-01-23 21:40:34 -06:00
parent f9efa81bb4
commit 9964eb63fb
9 changed files with 191 additions and 72 deletions

View File

@@ -48,8 +48,7 @@ class AcarsTest extends TestCase
protected function getPirep($pirep_id)
{
$this->user = factory(App\Models\User::class)->create();
$resp = $this
->get('/api/pireps/' . $pirep_id);
$resp = $this ->get('/api/pireps/' . $pirep_id);
$resp->assertStatus(200);
return $resp->json();
}
@@ -163,6 +162,17 @@ class AcarsTest extends TestCase
$response = $this->post($uri, ['flight_time' => '130']);
$response->assertStatus(200); // invalid flight time
# Add a comment
$uri = '/api/pireps/'.$pirep_id.'/comments';
$response = $this->post($uri, ['comment' => 'A comment']);
$response->assertStatus(201);
$response = $this->get($uri);
$response->assertStatus(200);
$comments = $response->json();
$this->assertCount(1, $comments);
}
/**

View File

@@ -1,6 +1,7 @@
<?php
#use Swagger\Serializer;
use App\Services\FareService;
use App\Models\User;
/**
@@ -166,7 +167,12 @@ class ApiTest extends TestCase
*/
public function testGetAircraft()
{
$fare_svc = app(FareService::class);
$subfleet = factory(App\Models\Subfleet::class)->create();
$fare = factory(App\Models\Fare::class)->create();
$fare_svc->setForSubfleet($subfleet, $fare);
$aircraft = factory(App\Models\Aircraft::class)->create([
'subfleet_id' => $subfleet->id
]);