47 lines
1.1 KiB
PHP
47 lines
1.1 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('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);
|
||
|
|
});
|
||
|
|
});
|