diff options
author | Joas Schilling <coding@schilljs.com> | 2022-03-23 23:38:53 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-03-23 23:38:53 +0300 |
commit | d683e0d3d1448111d8de1ffaa480dcb203f61143 (patch) | |
tree | 74b29f9cefd1452aff85cec4483b65f4e50e7880 /tests/lib | |
parent | c1215f573ae98fb3cf66f9ff5dc408574a7df560 (diff) |
Automatically cut the token name on the first level
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Authentication/Token/ManagerTest.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/lib/Authentication/Token/ManagerTest.php b/tests/lib/Authentication/Token/ManagerTest.php index 8b40fb9b669..5f024bb1d43 100644 --- a/tests/lib/Authentication/Token/ManagerTest.php +++ b/tests/lib/Authentication/Token/ManagerTest.php @@ -114,6 +114,37 @@ class ManagerTest extends TestCase { $this->assertSame($token, $actual); } + public function testGenerateTokenTooLongName() { + $token = $this->createMock(IToken::class); + $token->method('getName') + ->willReturn(str_repeat('a', 120) . '…'); + + + $this->publicKeyTokenProvider->expects($this->once()) + ->method('generateToken') + ->with( + 'token', + 'uid', + 'loginName', + 'password', + str_repeat('a', 120) . '…', + IToken::TEMPORARY_TOKEN, + IToken::REMEMBER + )->willReturn($token); + + $actual = $this->manager->generateToken( + 'token', + 'uid', + 'loginName', + 'password', + str_repeat('a', 200), + IToken::TEMPORARY_TOKEN, + IToken::REMEMBER + ); + + $this->assertSame(121, mb_strlen($actual->getName())); + } + public function tokenData(): array { return [ [new PublicKeyToken()], |