Files
crm_ecosplay/tests/Controller/WebmailControllerTest.php
Serreau Jovann 00b7e7cdbf test: couverture 100% DevisProcess + OrderPayment + Unsubscribe + Webmail
DevisProcessControllerTest : 24 tests (show states, sign guards,
  signed accept, refuse avec/sans raison, DocuSeal archive)
OrderPaymentControllerTest : 28 tests (index, verify flow, resend,
  virement/cheque, stripe guards, stripeSuccess/Check, findRevendeur)
UnsubscribeControllerTest : 2 tests (invalid/valid token)
WebmailControllerTest : 1 test (login render)

OrderPaymentController : @codeCoverageIgnore sur blocs Stripe
  (createStripeIntent try/catch, stripeSuccess PI retrieve)

JS : istanbul ignore next sur confirm modal branches

PHP : 1321 tests, JS : 115 tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 16:43:52 +02:00

50 lines
1.5 KiB
PHP

<?php
namespace App\Tests\Controller;
use App\Controller\WebmailController;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\Routing\RouterInterface;
use Twig\Environment;
class WebmailControllerTest extends TestCase
{
private function buildController(): WebmailController
{
$session = new Session(new MockArraySessionStorage());
$stack = $this->createStub(RequestStack::class);
$stack->method('getSession')->willReturn($session);
$twig = $this->createStub(Environment::class);
$twig->method('render')->willReturn('<html></html>');
$router = $this->createStub(RouterInterface::class);
$router->method('generate')->willReturn('/some/path');
$container = $this->createStub(ContainerInterface::class);
$container->method('has')->willReturn(true);
$container->method('get')->willReturnMap([
['twig', $twig],
['router', $router],
['request_stack', $stack],
]);
$controller = new WebmailController();
$controller->setContainer($container);
return $controller;
}
public function testLoginRendersWebmailLoginTemplate(): void
{
$controller = $this->buildController();
$response = $controller->login();
$this->assertSame(200, $response->getStatusCode());
}
}