jonnybarnes.uk/tests/Feature/PlacesTest.php

42 lines
795 B
PHP
Raw Normal View History

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-03-17 18:38:18 +00:00
use Tests\TestCase;
2017-02-18 14:31:49 +00:00
class PlacesTest extends TestCase
{
/**
* 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
{
$place = Place::factory()->create();
$response = $this->get($place->longurl);
2017-02-18 14:31:49 +00:00
$response->assertViewHas('place', $place);
}
/** @test */
public function unknownPlaceGives404()
{
$response = $this->get('/places/unknown');
$response->assertNotFound();
}
2017-02-18 14:31:49 +00:00
}