123 lines
3.2 KiB
PHP
123 lines
3.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('TunnelController', function () {
|
||
|
|
it('can access get /commande/confirmation', function () {
|
||
|
|
// GIVEN
|
||
|
|
$this->seed(ContentSeeder::class);
|
||
|
|
View::share('PageList', Page::getCached()
|
||
|
|
->mapWithKeys(fn ($page) => [
|
||
|
|
$page->slug->value() => $page,
|
||
|
|
]));
|
||
|
|
Cache::flush();
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$response = $this->get('/commande/confirmation');
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$response->assertStatus(302);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('can access post /commande/confirmation', function () {
|
||
|
|
// GIVEN
|
||
|
|
$this->seed(ContentSeeder::class);
|
||
|
|
View::share('PageList', Page::getCached()
|
||
|
|
->mapWithKeys(fn ($page) => [
|
||
|
|
$page->slug->value() => $page,
|
||
|
|
]));
|
||
|
|
Cache::flush();
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$response = $this->post('/commande/confirmation', []);
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$response->assertStatus(302);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('can access get /commande/confirmation/1', function () {
|
||
|
|
// GIVEN
|
||
|
|
$this->seed(ContentSeeder::class);
|
||
|
|
View::share('PageList', Page::getCached()
|
||
|
|
->mapWithKeys(fn ($page) => [
|
||
|
|
$page->slug->value() => $page,
|
||
|
|
]));
|
||
|
|
Cache::flush();
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$response = $this->get('/commande/confirmation/1');
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$response->assertStatus(302);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('can access get /commande/creneaux', function () {
|
||
|
|
// GIVEN
|
||
|
|
$this->seed(ContentSeeder::class);
|
||
|
|
View::share('PageList', Page::getCached()
|
||
|
|
->mapWithKeys(fn ($page) => [
|
||
|
|
$page->slug->value() => $page,
|
||
|
|
]));
|
||
|
|
Cache::flush();
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$response = $this->get('/commande/creneaux');
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$response->assertStatus(302);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('can access post /commande/creneaux', function () {
|
||
|
|
// GIVEN
|
||
|
|
$this->seed(ContentSeeder::class);
|
||
|
|
View::share('PageList', Page::getCached()
|
||
|
|
->mapWithKeys(fn ($page) => [
|
||
|
|
$page->slug->value() => $page,
|
||
|
|
]));
|
||
|
|
Cache::flush();
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$response = $this->post('/commande/creneaux', []);
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$response->assertStatus(302);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('can access get /commande/panier', function () {
|
||
|
|
// GIVEN
|
||
|
|
$this->seed(ContentSeeder::class);
|
||
|
|
View::share('PageList', Page::getCached()
|
||
|
|
->mapWithKeys(fn ($page) => [
|
||
|
|
$page->slug->value() => $page,
|
||
|
|
]));
|
||
|
|
Cache::flush();
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$response = $this->get('/commande/panier');
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$response->assertStatus(302);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('can access post /commande/panier', function () {
|
||
|
|
// GIVEN
|
||
|
|
$this->seed(ContentSeeder::class);
|
||
|
|
View::share('PageList', Page::getCached()
|
||
|
|
->mapWithKeys(fn ($page) => [
|
||
|
|
$page->slug->value() => $page,
|
||
|
|
]));
|
||
|
|
Cache::flush();
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$response = $this->post('/commande/panier', []);
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$response->assertStatus(302);
|
||
|
|
});
|
||
|
|
});
|