Skip to content

Commit 3caebd4

Browse files
committed
bug #13089 Update http_authentication.rst (thled)
This PR was submitted for the 5.0 branch but it was merged into the 4.4 branch instead. Discussion ---------- 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. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 0561b5a Update http_authentication.rst
2 parents aface30 + 0561b5a commit 3caebd4

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)