Move subfleet add/remove to fleet service for a flight

This commit is contained in:
Nabeel Shahzad
2018-03-23 14:10:18 -05:00
parent 1161106d9c
commit f8f5a71564
5 changed files with 61 additions and 2 deletions

View File

@@ -170,6 +170,28 @@ class FlightTest extends TestCase
$this->assertEquals($flight->id, $body['data'][0]['id']);
}
/**
*
*/
public function testAddSubfleet()
{
$subfleet = factory(App\Models\Subfleet::class)->create();
$flight = factory(App\Models\Flight::class)->create();
$fleetSvc = app(App\Services\FleetService::class);
$fleetSvc->addSubfleetToFlight($subfleet, $flight);
$flight->refresh();
$found = $flight->subfleets()->get();
$this->assertCount(1, $found);
# Make sure it hasn't been added twice
$fleetSvc->addSubfleetToFlight($subfleet, $flight);
$flight->refresh();
$found = $flight->subfleets()->get();
$this->assertCount(1, $found);
}
/**
* Add/remove a bid, test the API, etc
* @throws \App\Services\Exception