Skip to content

Commit

Permalink
Add LogoutUrlExtension in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Mar 5, 2023
1 parent 7615ab4 commit 74451b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 2 additions & 0 deletions tests/Pug/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Symfony\Bridge\Twig\Extension\CsrfExtension;
use Symfony\Bridge\Twig\Extension\CsrfRuntime;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\LogoutUrlExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
Expand Down Expand Up @@ -36,6 +37,7 @@ protected function getTwigEnvironment(): Environment
));
$this->twig->addExtension(new CsrfExtension());
$this->twig->addExtension(new FormExtension());
$this->twig->addExtension(new LogoutUrlExtension(new LogoutUrlGenerator()));
$this->twig->addExtension(new TranslationExtension());
$this->twig->addRuntimeLoader(new FactoryRuntimeLoader([
CsrfRuntime::class => static fn () => new CsrfRuntime(new TestCsrfTokenManager()),
Expand Down
11 changes: 0 additions & 11 deletions tests/Pug/PugSymfonyEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\ResolvedFormTypeFactory;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage as BaseTokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Csrf\CsrfTokenManager;
use Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator;
use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage;
use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage;
use Symfony\Component\Security\Csrf\TokenStorage\TokenStorageInterface;
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator as BaseLogoutUrlGenerator;
use Symfony\Component\Translation\Translator;
Expand Down Expand Up @@ -289,12 +286,6 @@ public function testLogoutHelper()
}
}

if ($generator) {
include_once __DIR__.'/LogoutUrlHelper.php';
$logoutUrlHelper = new LogoutUrlHelper($generator);
self::$kernel->getContainer()->set('templating.helper.logout_url', $logoutUrlHelper);
}

$pugSymfony = $this->getPugSymfonyEngine();

self::assertSame('<a href="logout-url"></a><a href="logout-path"></a>', trim($pugSymfony->render('logout.pug')));
Expand Down Expand Up @@ -328,9 +319,7 @@ public function testFormHelpers()
*/
public function testRenderViaTwig()
{
$container = self::$kernel->getContainer();
$controller = new TestController();
$controller->setContainer($container);
$twig = $this->getTwigEnvironment();
$this->getPugSymfonyEngine();

Expand Down

0 comments on commit 74451b1

Please sign in to comment.