Skip to content

Access Session from the KernelBrowser #46023

Open
@Grafikart

Description

@Grafikart

Description

When using the WebTestCase there is no way to access the session used by the loginUser() method here (https://github.com/symfony/framework-bundle/blob/5.4/KernelBrowser.php#L145).

It's hard to add new information to the session for specific use case (csrf for instance). A way to access the session would simplify the work with the client. It's not possible to use RequestStack since the request is not yet initialized.

Example

$this->client->loginUser($user);
$this->client->getSession(); // Session

Why

With the deprecation of the SessionInterface service, there is no way to access the Session that will be sent when doing requests with the client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BrowserKitDXDX = Developer eXperience (anything that improves the experience of using Symfony)HttpFoundationKeep open

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions