diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 043cad6..10d8038 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -2,8 +2,8 @@ namespace App\Exceptions; -use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Throwable; class Handler extends ExceptionHandler { @@ -29,10 +29,10 @@ class Handler extends ExceptionHandler /** * Report or log an exception. * - * @param \Exception $exception + * @param \Throwable $exception * @return void */ - public function report(Exception $exception) + public function report(Throwable $exception) { parent::report($exception); } @@ -41,10 +41,10 @@ class Handler extends ExceptionHandler * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request - * @param \Exception $exception + * @param \Throwable $exception * @return \Illuminate\Http\Response */ - public function render($request, Exception $exception) + public function render($request, Throwable $exception) { return parent::render($request, $exception); } diff --git a/tests/Feature/Api/OutletListingTest.php b/tests/Feature/Api/OutletListingTest.php index 2a44046..a07de4d 100644 --- a/tests/Feature/Api/OutletListingTest.php +++ b/tests/Feature/Api/OutletListingTest.php @@ -3,8 +3,8 @@ namespace Tests\Feature\Api; use App\Outlet; -use Tests\BrowserKitTest as TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; +use Tests\BrowserKitTest as TestCase; class OutletListingTest extends TestCase { @@ -17,21 +17,28 @@ class OutletListingTest extends TestCase $this->getJson(route('api.outlets.index')); - $this->seeJsonSubset([ + $this->seeJsonContains([ 'type' => 'FeatureCollection', 'features' => [ [ 'type' => 'Feature', 'properties' => [ - 'name' => $outlet->name, - 'address' => $outlet->address, - 'coordinate' => $outlet->coordinate, + 'name' => $outlet->name, + 'address' => $outlet->address, + 'coordinate' => $outlet->coordinate, + 'latitude' => (string) $outlet->latitude, + 'longitude' => (string) $outlet->longitude, + 'map_popup_content' => $outlet->map_popup_content, + 'creator_id' => (string) $outlet->creator_id, + 'id' => $outlet->id, + 'created_at' => $outlet->created_at, + 'updated_at' => $outlet->updated_at, ], 'geometry' => [ 'type' => 'Point', 'coordinates' => [ - $outlet->longitude, - $outlet->latitude, + (string) $outlet->longitude, + (string) $outlet->latitude, ], ], ], diff --git a/tests/Unit/Models/OutletTest.php b/tests/Unit/Models/OutletTest.php index 5a0d881..369aac4 100644 --- a/tests/Unit/Models/OutletTest.php +++ b/tests/Unit/Models/OutletTest.php @@ -2,14 +2,14 @@ namespace Tests\Unit\Models; -use App\User; use App\Outlet; +use App\User; +use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\BrowserKitTest as TestCase; -use Illuminate\Foundation\Testing\DatabaseMigrations; class OutletTest extends TestCase { - use DatabaseMigrations; + use RefreshDatabase; /** @test */ public function an_outlet_has_name_link_attribute() @@ -52,7 +52,7 @@ class OutletTest extends TestCase /** @test */ public function an_outlet_has_map_popup_content_attribute() { - $outlet = factory(Outlet::class)->make(['lat' => '-3.333333', 'long' => '114.583333']); + $outlet = factory(Outlet::class)->create(['latitude' => '-3.333333', 'longitude' => '114.583333']); $mapPopupContent = ''; $mapPopupContent .= '