2016-05-19 15:01:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Tests;
|
|
|
|
|
2017-02-03 21:49:49 +00:00
|
|
|
use BrowserKitTest;
|
2016-05-19 15:01:28 +01:00
|
|
|
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
|
2017-02-03 21:49:49 +00:00
|
|
|
class PlacesTest extends BrowserKitTest
|
2016-05-19 15:01:28 +01:00
|
|
|
{
|
|
|
|
protected $appurl;
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
$this->appurl = config('app.url');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the `/places` page for OK response.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testPlacesPage()
|
|
|
|
{
|
|
|
|
$this->visit($this->appurl . '/places')
|
|
|
|
->assertResponseOK();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test a specific place.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testSinglePlace()
|
|
|
|
{
|
|
|
|
$this->visit($this->appurl . '/places/the-bridgewater-pub')
|
|
|
|
->see('The Bridgewater Pub');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the nearby method returns a collection.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testNearbyMethod()
|
|
|
|
{
|
|
|
|
$nearby = \App\Place::near(53.5, -2.38, 1000);
|
|
|
|
$this->assertEquals('the-bridgewater-pub', $nearby[0]->slug);
|
|
|
|
}
|
|
|
|
}
|