2017-02-18 14:31:49 +00:00
|
|
|
<?php
|
|
|
|
|
2021-03-17 18:38:18 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2017-02-18 14:31:49 +00:00
|
|
|
namespace Tests\Feature;
|
|
|
|
|
2017-12-19 16:00:42 +00:00
|
|
|
use App\Models\Place;
|
2021-08-31 12:48:43 +01:00
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
2021-03-17 18:38:18 +00:00
|
|
|
use Tests\TestCase;
|
2017-02-18 14:31:49 +00:00
|
|
|
|
|
|
|
class PlacesTest extends TestCase
|
|
|
|
{
|
2021-08-31 12:48:43 +01:00
|
|
|
use RefreshDatabase;
|
|
|
|
|
2017-02-18 14:31:49 +00:00
|
|
|
/**
|
|
|
|
* Test the `/places` page for OK response.
|
|
|
|
*
|
2021-03-17 18:38:18 +00:00
|
|
|
* @test
|
2017-02-18 14:31:49 +00:00
|
|
|
*/
|
2021-03-17 18:38:18 +00:00
|
|
|
public function placesPageLoads(): void
|
2017-02-18 14:31:49 +00:00
|
|
|
{
|
|
|
|
$response = $this->get('/places');
|
|
|
|
$response->assertStatus(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test a specific place.
|
|
|
|
*
|
2021-03-17 18:38:18 +00:00
|
|
|
* @test
|
2017-02-18 14:31:49 +00:00
|
|
|
*/
|
2021-03-17 18:38:18 +00:00
|
|
|
public function singlePlacePageLoads(): void
|
2017-02-18 14:31:49 +00:00
|
|
|
{
|
2021-08-31 12:28:00 +01:00
|
|
|
$place = Place::factory()->create();
|
|
|
|
$response = $this->get($place->longurl);
|
2017-02-18 14:31:49 +00:00
|
|
|
$response->assertViewHas('place', $place);
|
|
|
|
}
|
2020-08-09 15:54:10 +01:00
|
|
|
|
|
|
|
/** @test */
|
|
|
|
public function unknownPlaceGives404()
|
|
|
|
{
|
|
|
|
$response = $this->get('/places/unknown');
|
|
|
|
$response->assertNotFound();
|
|
|
|
}
|
2017-02-18 14:31:49 +00:00
|
|
|
}
|