diff --git a/config/settings.php b/config/settings.php deleted file mode 100644 index 5a778820..00000000 --- a/config/settings.php +++ /dev/null @@ -1,22 +0,0 @@ - env('APP_SETTINGS_STORE', 'database'), - - // if the json store is used, give the full path to the .json file - // that the store writes to. - 'path' => storage_path().'/settings.json', - - // if the database store is used, set the name of the table used.. - 'table' => 'settings', - - // If the database store is used, you can set which connection to use. if - // set to null, the default connection will be used. - 'connection' => null, - - // If you want to use custom column names in database store you could - // set them in this configuration - 'keyColumn' => 'key', - 'valueColumn' => 'value' -); diff --git a/database/migrations/2017_12_10_014930_create_settings_table.php b/database/migrations/2017_12_10_014930_create_settings_table.php index 0cb46837..ea26f4f5 100644 --- a/database/migrations/2017_12_10_014930_create_settings_table.php +++ b/database/migrations/2017_12_10_014930_create_settings_table.php @@ -79,6 +79,6 @@ class CreateSettingsTable extends Migration */ public function down() { - Schema::drop($this->tablename); + Schema::drop('settings'); } } diff --git a/phpvms.iml b/phpvms.iml index 7f9b9fe1..4a276633 100644 --- a/phpvms.iml +++ b/phpvms.iml @@ -114,7 +114,6 @@ - @@ -124,7 +123,6 @@ - @@ -168,8 +166,6 @@ - - @@ -203,7 +199,6 @@ - @@ -217,7 +212,6 @@ - @@ -227,7 +221,6 @@ - @@ -271,8 +264,6 @@ - - @@ -306,7 +297,6 @@ - diff --git a/tests/ApiTest.php b/tests/ApiTest.php index e0bc0cc3..a8cd0900 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -5,10 +5,6 @@ */ class ApiTest extends TestCase { - protected static $headers = [ - 'Authorization' => 'testapikey' - ]; - public function setUp() { parent::setUp(); @@ -30,7 +26,7 @@ class ApiTest extends TestCase ->assertStatus(401); // Test upper/lower case of Authorization header, etc - $this->withHeaders(self::$headers)->get($uri) + $this->withHeaders(self::$auth_headers)->get($uri) ->assertStatus(200) ->assertJson(['icao' => 'KJFK'], true); @@ -44,11 +40,11 @@ class ApiTest extends TestCase */ public function testAirportRequest() { - $this->withHeaders(self::$headers)->get('/api/airports/KJFK') + $this->withHeaders(self::$auth_headers)->get('/api/airports/KJFK') ->assertStatus(200) ->assertJson(['icao' => 'KJFK'], true); - $this->withHeaders(self::$headers)->get('/api/airports/UNK') + $this->withHeaders(self::$auth_headers)->get('/api/airports/UNK') ->assertStatus(404); } } diff --git a/tests/FlightTest.php b/tests/FlightTest.php index d4ae1977..14961771 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -6,7 +6,6 @@ class FlightTest extends TestCase public function setUp() { parent::setUp(); - $this->addData('base'); } @@ -15,34 +14,17 @@ class FlightTest extends TestCase $flight = new App\Models\Flight; $flight->airline_id = 1; $flight->flight_number = 10; - $flight->dpt_airport_id = 1; - $flight->arr_airport_id = 2; + $flight->dpt_airport_id = 'KAUS'; + $flight->arr_airport_id = 'KJFK'; $flight->save(); + return $flight->id; } public function testGetFlight() { $flight_id = $this->addFlight(); - $response = $this->json('GET', '/api/flight/'.$flight_id); - /*$response->assertStatus(200); - $response->assertJson(['data' => true]);*/ - } - - /** - * mainly to test the model relationships work correctly - */ - public function XtestAddFlight() - { - $this->markTestSkipped( - 'This test has not been implemented yet.' - ); - - $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'); + $this->get('/api/flight/'.$flight_id, self::$auth_headers) + ->assertStatus(200); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index fadbef34..59e93009 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -18,6 +18,10 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase protected $baseUrl = 'http://localhost'; protected $connectionsToTransact = ['testing']; + protected static $auth_headers = [ + 'Authorization' => 'testapikey' + ]; + public function __construct($name = null, array $data = [], $dataName = '') { parent::__construct($name, $data, $dataName); }