Skip to content

Commit c997624

Browse files
committed
Fix for TraceableAuthenticator debug when no Auth
1 parent fee9b30 commit c997624

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static function (BadgeInterface $badge): array {
5454
'resolved' => $badge->isResolved(),
5555
];
5656
},
57-
$this->passport->getBadges(),
57+
$this->passport?->getBadges() ?? [],
5858
),
5959
];
6060
}

src/Symfony/Component/Security/Http/Tests/Authenticator/Debug/TraceableAuthenticatorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,14 @@ public function testGetInfo()
3636
$this->assertSame($passport, $traceable->authenticate($request));
3737
$this->assertSame($passport, $traceable->getInfo()['passport']);
3838
}
39+
40+
public function testGetInfoWithoutAuth()
41+
{
42+
$authenticator = $this->createMock(AuthenticatorInterface::class);
43+
44+
$traceable = new TraceableAuthenticator($authenticator);
45+
$this->assertNull( $traceable->getInfo()['passport']);
46+
$this->assertIsArray( $traceable->getInfo()['badges']);
47+
$this->assertSame( [], $traceable->getInfo()['badges']);
48+
}
3949
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy