Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Authentication/Token/ManagerTest.php31
-rw-r--r--tests/lib/Comments/ManagerTest.php14
2 files changed, 38 insertions, 7 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()],
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index 23a9346909a..961f8dfdd41 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -3,6 +3,7 @@
namespace Test\Comments;
use OC\Comments\Comment;
+use OC\Comments\EmojiHelper;
use OC\Comments\Manager;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Comments\IComment;
@@ -74,6 +75,7 @@ class ManagerTest extends TestCase {
$this->createMock(LoggerInterface::class),
$this->createMock(IConfig::class),
$this->createMock(ITimeFactory::class),
+ new EmojiHelper($this->connection),
$this->createMock(IInitialStateService::class)
);
}
@@ -1181,15 +1183,13 @@ class ManagerTest extends TestCase {
public function providerTestReactionMessageSize(): array {
return [
- ['a', true],
- ['1', true],
- ['12', true],
- ['123', false],
+ ['a', false],
+ ['1', false],
['👍', true],
- ['👍👍', true],
+ ['👍👍', false],
['👍🏽', true],
- ['👍🏽👍', false],
- ['👍🏽👍🏽', false],
+ ['👨🏽‍💻', true],
+ ['👨🏽‍💻👍', false],
];
}