Skip to content

Commit 5dabaf4

Browse files
turegjorupclaude
andcommitted
Cover the decodeKey invalid-base64 branch
The strict base64_decode() fallback added to CliLoginHelper::decodeKey needs a test for the false return path, restoring 100% line coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 02a6bc9 commit 5dabaf4

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/Util/CliLoginHelperTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ public function testEncodeAndDecode(): void
2626
$this->assertEquals($randomUsername, $decodedUsername);
2727
}
2828

29+
public function testDecodeKeyReturnsInputWhenNotValidBase64(): void
30+
{
31+
$cache = new ArrayAdapter();
32+
$cliHelper = new CliLoginHelper($cache);
33+
34+
// Strict base64_decode() rejects input with characters outside the
35+
// base64 alphabet; decodeKey() then returns the value unchanged.
36+
$notBase64 = 'not valid base64 !!@@';
37+
38+
$this->assertSame($notBase64, $cliHelper->decodeKey($notBase64));
39+
}
40+
2941
public function testThrowExceptionIfTokenDoesNotExist(): void
3042
{
3143
$this->expectException(ItkOpenIdConnectBundleException::class);

0 commit comments

Comments
 (0)