Skip to content

Commit 0561b5a

Browse files
thledOskarStark
authored andcommitted
Update http_authentication.rst
The preferred way to get the container in functional tests is `self::$container` (see https://symfony.com/doc/current/testing.html#accessing-the-container). The issue with `$this->client->getContainer()` is that `Symfony\Bundle\FrameworkBundle\KernelBrowser::getContainer()` can return `null`. This can lead to a NullPointerException when calling `get()` on it.
1 parent aface30 commit 0561b5a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

testing/http_authentication.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ needs::
111111

112112
private function logIn()
113113
{
114-
$session = $this->client->getContainer()->get('session');
114+
$session = self::$container->get('session');
115115

116116
$firewallName = 'secure_area';
117117
// if you don't define multiple connected firewalls, the context defaults to the firewall name

0 commit comments

Comments
 (0)