ldc-cocotte/tests/Feature/App/Http/Controllers/Fo/Pages/PageControllerTest.php

78 lines
2 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\Page;
use Database\Seeders\ContentSeeder;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\View;
describe('PageController', function () {
it('can access get /cgv', function () {
/** @var \Tests\TestCase $this */
// GIVEN
$this->seed(ContentSeeder::class);
View::share('PageList', Page::getCached()
->mapWithKeys(fn ($page) => [
$page->slug->value() => $page,
]));
Cache::flush();
// WHEN
$response = $this->get('/cgv');
// THEN
$response->assertStatus(200);
});
it('can access get /charte-de-confidentialite', function () {
/** @var \Tests\TestCase $this */
// GIVEN
$this->seed(ContentSeeder::class);
View::share('PageList', Page::getCached()
->mapWithKeys(fn ($page) => [
$page->slug->value() => $page,
]));
Cache::flush();
// WHEN
$response = $this->get('/charte-de-confidentialite');
// THEN
$response->assertStatus(200);
});
it('can access get /faq', function () {
/** @var \Tests\TestCase $this */
// GIVEN
$this->seed(ContentSeeder::class);
View::share('PageList', Page::getCached()
->mapWithKeys(fn ($page) => [
$page->slug->value() => $page,
]));
Cache::flush();
// WHEN
$response = $this->get('/faq');
// THEN
$response->assertStatus(200);
});
it('can access get /mentions-legales', function () {
/** @var \Tests\TestCase $this */
// GIVEN
$this->seed(ContentSeeder::class);
View::share('PageList', Page::getCached()
->mapWithKeys(fn ($page) => [
$page->slug->value() => $page,
]));
Cache::flush();
// WHEN
$response = $this->get('/mentions-legales');
// THEN
$response->assertStatus(200);
});
});