Skip to content

Commit 5bb4402

Browse files
minor #751 [Live] Fixing test that needs a session (weaverryan)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Live] Fixing test that needs a session | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Tickets | None | License | MIT Fixing up a test that went rogue... Other failures are due to deprecations from - doctrine/DoctrineBundle#1636 - if i'm missing something obvious and someone can help, that would be awesome :) Commits ------- 4fcb2137 [Live] Bumping min versions of 2 packages to fix tests e134f2c2 [Live] Fixing test that needs a session
2 parents 715e1ee + acbb2bd commit 5bb4402

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/LiveComponent/composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
"doctrine/annotations": "^1.0",
3636
"doctrine/doctrine-bundle": "^2.0",
3737
"doctrine/orm": "^2.7",
38+
"doctrine/persistence": "^2.5.2|^3.0",
3839
"phpdocumentor/reflection-docblock": "5.x-dev",
3940
"symfony/dependency-injection": "^5.4|^6.0",
4041
"symfony/form": "^5.4|^6.0",
4142
"symfony/framework-bundle": "^5.4|^6.0",
43+
"symfony/property-info": "^5.4|^6.0",
4244
"symfony/phpunit-bridge": "^6.0",
4345
"symfony/security-csrf": "^5.4|^6.0",
4446
"symfony/twig-bundle": "^5.4|^6.0",

src/LiveComponent/tests/Integration/EventListener/DataModelPropsSubscriberTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@
1212
namespace Symfony\UX\LiveComponent\Tests\Integration;
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15+
use Symfony\Component\HttpFoundation\Request;
1516
use Symfony\UX\TwigComponent\ComponentRenderer;
1617

1718
final class DataModelPropsSubscriberTest extends KernelTestCase
1819
{
1920
public function testDataModelPropsAreSharedToChild(): void
2021
{
22+
// work around so that a session is available so CSRF doesn't fail
23+
$session = self::getContainer()->get('session.factory')->createSession();
24+
$request = Request::create('/');
25+
$request->setSession($session);
26+
$requestStack = self::getContainer()->get('request_stack');
27+
$requestStack->push($request);
28+
2129
/** @var ComponentRenderer $renderer */
2230
$renderer = self::getContainer()->get('ux.twig_component.component_renderer');
2331

0 commit comments

Comments
 (0)