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

47 lines
1.1 KiB
PHP
Raw Normal View History

2026-06-14 21:32:07 +02:00
<?php
declare(strict_types=1);
use App\Models\Page;
use Database\Seeders\ContentSeeder;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\View;
describe('ContactController', function () {
beforeEach(function () {
\Config::set('mail.to.contact', 'test@example.com');
});
it('can access get /contactez-nous', function () {
// GIVEN
$this->seed(ContentSeeder::class);
View::share('PageList', Page::getCached()
->mapWithKeys(fn ($page) => [
$page->slug->value() => $page,
]));
Cache::flush();
// WHEN
$response = $this->get('/contactez-nous');
// THEN
$response->assertStatus(404);
});
it('can access post /contactez-nous', function () {
// GIVEN
$this->seed(ContentSeeder::class);
View::share('PageList', Page::getCached()
->mapWithKeys(fn ($page) => [
$page->slug->value() => $page,
]));
Cache::flush();
// WHEN
$response = $this->post('/contactez-nous', []);
// THEN
$response->assertStatus(302);
});
});