phpvms/tests/FlightTest.php

49 lines
1.1 KiB
PHP
Raw Normal View History

2017-06-20 00:30:39 +08:00
<?php
class FlightTest extends TestCase
{
public function setUp()
{
parent::setUp();
2017-08-15 12:36:49 +08:00
$this->addData('base');
2017-06-20 00:30:39 +08:00
}
public function addFlight()
{
$flight = new App\Models\Flight;
$flight->airline_id = 1;
2017-08-15 12:36:49 +08:00
$flight->flight_number = 10;
2017-06-20 00:30:39 +08:00
$flight->dpt_airport_id = 1;
$flight->arr_airport_id = 2;
$flight->save();
2017-08-15 12:36:49 +08:00
return $flight->id;
}
2017-11-23 01:52:02 +08:00
public function testGetFlight()
2017-08-15 12:36:49 +08:00
{
$flight_id = $this->addFlight();
$response = $this->json('GET', '/api/flight/'.$flight_id);
2017-11-23 02:09:20 +08:00
/*$response->assertStatus(200);
$response->assertJson(['data' => true]);*/
2017-06-20 00:30:39 +08:00
}
/**
* mainly to test the model relationships work correctly
*/
2017-07-05 02:09:44 +08:00
public function XtestAddFlight()
2017-06-20 00:30:39 +08:00
{
$this->markTestSkipped(
'This test has not been implemented yet.'
);
2017-06-20 00:30:39 +08:00
$this->addFlight();
$flight = App\Models\Flight::where('flight_number', 100)->first();
$this->assertEquals($flight->dpt_airport->icao, 'KAUS');
$this->assertEquals($flight->arr_airport->icao, 'KJFK');
}
}