feat(revervation): [Ajoute la création de session de réservation et le flow]
🐛 fix(PurgeCommandTest): [Utilise addCommand au lieu de add pour les commandes]
📝 chore(deps): [Mise à jour des dépendances Composer et corrections]
🐛 fix(KeycloakAuthenticator): [Corrige le type nullable de l'exception start]
 feat(Customer): [Ajoute les sessions de commandes aux entités Customer]
♻️ refactor(AppLogger): [Refactorise l'AppLogger pour obtenir l'UserAgent]
 feat(FlowReserve): [Ajoute une action de validation du panier]
```
This commit is contained in:
Serreau Jovann
2026-01-31 13:49:25 +01:00
parent 4227c3d3b0
commit 0be752c145
117 changed files with 8798 additions and 2645 deletions

View File

@@ -0,0 +1,95 @@
<?php
namespace App\Tests\Security;
use App\Security\IntranetLocked;
use App\Service\Mailer\Mailer;
use App\Service\Signature\Client as SignatureClient;
use App\Service\Search\Client as SearchClient;
use App\Service\Stripe\Client as StripeClient;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request;
use Twig\Environment;
#[AllowMockObjectsWithoutExpectations]
class IntranetLockedTest extends TestCase
{
private $twig;
private $signatureClient;
private $searchClient;
private $stripeClient;
private $mailer;
private $listener;
protected function setUp(): void
{
$this->twig = $this->createMock(Environment::class);
$this->signatureClient = $this->createMock(SignatureClient::class);
$this->searchClient = $this->createMock(SearchClient::class);
$this->stripeClient = $this->createMock(StripeClient::class);
$this->mailer = $this->createMock(Mailer::class);
$this->listener = new IntranetLocked(
$this->twig,
$this->signatureClient,
$this->searchClient,
$this->stripeClient,
$this->mailer
);
}
public function testOnLockedWhenEnabled()
{
$_ENV['INTRANET_LOCK'] = 'true';
$kernel = $this->createMock(HttpKernelInterface::class);
$request = new Request();
$event = new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST);
$this->twig->expects($this->once())->method('render')->with('security/locked.twig')->willReturn('Locked');
$this->listener->onLocked($event);
$response = $event->getResponse();
$this->assertInstanceOf(Response::class, $response);
$this->assertEquals(Response::HTTP_FORBIDDEN, $response->getStatusCode());
unset($_ENV['INTRANET_LOCK']);
}
public function testOnControlAllServicesUp()
{
$kernel = $this->createMock(HttpKernelInterface::class);
$request = new Request();
$event = new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST);
$this->signatureClient->method('status')->willReturn(true);
$this->searchClient->method('status')->willReturn(true);
$this->stripeClient->method('status')->willReturn(true);
$this->listener->onControl($event);
$this->assertNull($event->getResponse());
}
public function testOnControlServiceDown()
{
$kernel = $this->createMock(HttpKernelInterface::class);
$request = new Request();
$event = new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST);
$this->signatureClient->method('status')->willReturn(false);
$this->mailer->expects($this->once())->method('send');
$this->twig->expects($this->once())->method('render')->with('security/error.twig')->willReturn('Error');
$this->listener->onControl($event);
$response = $event->getResponse();
$this->assertInstanceOf(Response::class, $response);
$this->assertEquals(Response::HTTP_FORBIDDEN, $response->getStatusCode());
}
}