8000 Fix for TraceableAuthenticator debug when no Auth · symfony/symfony@a9d36a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a9d36a5

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

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

+1-1
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

+10
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)
0