From b095edc71e2d6ce3fcde37efc204a6d601d70fcf Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 18 Sep 2023 16:59:56 +0200 Subject: [PATCH] [FrameworkBundle] Add token attributes in `KernelBrowser::loginUser()` --- testing.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/testing.rst b/testing.rst index 4caca0751bb..73cac344391 100644 --- a/testing.rst +++ b/testing.rst @@ -717,13 +717,21 @@ You can pass any :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface` instance to ``loginUser()``. This method creates a special :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\TestBrowserToken` object and -stores in the session of the test client. +stores in the session of the test client. If you need to define custom +attributes in this token, you can use the ``tokenAttributes`` argument of the +:method:`Symfony\\Bundle\\FrameworkBundle\\KernelBrowser::loginUser` method. .. note:: By design, the ``loginUser()`` method doesn't work when using stateless firewalls. Instead, add the appropriate token/header in each ``request()`` call. +.. versionadded:: 6.4 + + The ``tokenAttributes`` argument of the + :method:`Symfony\\Bundle\\FrameworkBundle\\KernelBrowser::loginUser` method + was introduced in Symfony 6.4. + Making AJAX Requests ....................