Fix tests
This commit is contained in:
parent
531489bfde
commit
845514da2c
@ -30,7 +30,7 @@ class AirlineController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$airports = $this->airlineRepo->whereOrder(['active' => true], 'name');
|
$airports = $this->airlineRepo->whereOrder(['active' => true], 'name')->get();
|
||||||
|
|
||||||
return AirlineResource::collection($airports);
|
return AirlineResource::collection($airports);
|
||||||
}
|
}
|
||||||
|
@ -534,6 +534,9 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
Route::get('fleet', 'FleetController@index');
|
Route::get('fleet', 'FleetController@index');
|
||||||
Route::get('fleet/aircraft/{id}', 'FleetController@get_aircraft');
|
Route::get('fleet/aircraft/{id}', 'FleetController@get_aircraft');
|
||||||
|
|
||||||
|
Route::get('subfleet', 'FleetController@index');
|
||||||
|
Route::get('subfleet/aircraft/{id}', 'FleetController@get_aircraft');
|
||||||
|
|
||||||
Route::get('flights', 'FlightController@index');
|
Route::get('flights', 'FlightController@index');
|
||||||
Route::get('flights/search', 'FlightController@search');
|
Route::get('flights/search', 'FlightController@search');
|
||||||
Route::get('flights/{id}', 'FlightController@get');
|
Route::get('flights/{id}', 'FlightController@get');
|
||||||
|
@ -144,14 +144,14 @@ class ApiTest extends TestCase
|
|||||||
'airline_id' => 0,
|
'airline_id' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
factory(Airline::class, $size)->create();
|
factory(Subfleet::class, $size)->create();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Page 0 and page 1 should return the same thing
|
* Page 0 and page 1 should return the same thing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Test pagination
|
// Test pagination
|
||||||
$res = $this->get('/api/airlines?limit=1&page=0');
|
$res = $this->get('/api/fleet?limit=1&page=0');
|
||||||
$this->assertTrue($res->isOk());
|
$this->assertTrue($res->isOk());
|
||||||
$body = $res->json('data');
|
$body = $res->json('data');
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ class ApiTest extends TestCase
|
|||||||
|
|
||||||
$id_first = $body[0]['id'];
|
$id_first = $body[0]['id'];
|
||||||
|
|
||||||
$res = $this->get('/api/airlines?limit=1&page=1');
|
$res = $this->get('/api/fleet?limit=1&page=1');
|
||||||
$this->assertTrue($res->isOk());
|
$this->assertTrue($res->isOk());
|
||||||
$body = $res->json('data');
|
$body = $res->json('data');
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ class ApiTest extends TestCase
|
|||||||
* Page 2 should be different from page 1
|
* Page 2 should be different from page 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$res = $this->get('/api/airlines?limit=1&page=2');
|
$res = $this->get('/api/fleet?limit=1&page=2');
|
||||||
$this->assertTrue($res->isOk());
|
$this->assertTrue($res->isOk());
|
||||||
$body = $res->json('data');
|
$body = $res->json('data');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user