jonnybarnes.uk/tests/Feature/PlacesTest.php

44 lines
893 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;
use Illuminate\Foundation\Testing\RefreshDatabase;
2025-03-01 15:00:41 +00:00
use PHPUnit\Framework\Attributes\Test;
2021-03-17 18:38:18 +00:00
use Tests\TestCase;
2017-02-18 14:31:49 +00:00
class PlacesTest extends TestCase
{
use RefreshDatabase;
2017-02-18 14:31:49 +00:00
/**
* Test the `/places` page for OK response.
*/
2025-03-01 15:00:41 +00:00
#[Test]
2025-04-06 17:25:06 +01:00
public function places_page_loads(): void
2017-02-18 14:31:49 +00:00
{
$response = $this->get('/places');
$response->assertStatus(200);
}
/**
* Test a specific place.
*/
2025-03-01 15:00:41 +00:00
#[Test]
2025-04-06 17:25:06 +01:00
public function single_place_page_loads(): void
2017-02-18 14:31:49 +00:00
{
$place = Place::factory()->create();
2025-04-06 17:22:36 +01:00
$response = $this->get($place->uri);
2017-02-18 14:31:49 +00:00
$response->assertViewHas('place', $place);
}
2025-03-01 15:00:41 +00:00
#[Test]
2025-04-06 17:25:06 +01:00
public function unknown_place_gives404()
{
$response = $this->get('/places/unknown');
$response->assertNotFound();
}
2017-02-18 14:31:49 +00:00
}