Add Places Tests
This commit is contained in:
parent
29bd596b4a
commit
990c851432
2 changed files with 56 additions and 0 deletions
34
tests/Feature/PlacesTest.php
Normal file
34
tests/Feature/PlacesTest.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class PlacesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test the `/places` page for OK response.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_places_page()
|
||||
{
|
||||
$response = $this->get('/places');
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a specific place.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_single_place()
|
||||
{
|
||||
$place = \App\Place::where('slug', 'the-bridgewater-pub')->first();
|
||||
$response = $this->get('/places/the-bridgewater-pub');
|
||||
$response->assertViewHas('place', $place);
|
||||
}
|
||||
}
|
22
tests/Unit/PlacesTest.php
Normal file
22
tests/Unit/PlacesTest.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Place;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class PlacesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test the near method returns a collection.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_near_method()
|
||||
{
|
||||
$nearby = Place::near(53.5, -2.38, 1000);
|
||||
$this->assertEquals('the-bridgewater-pub', $nearby[0]->slug);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue