diff options
Diffstat (limited to 'tests/lib/Authentication/Token/PublicKeyTokenTest.php')
-rw-r--r-- | tests/lib/Authentication/Token/PublicKeyTokenTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenTest.php b/tests/lib/Authentication/Token/PublicKeyTokenTest.php new file mode 100644 index 00000000000..5f5f29c865f --- /dev/null +++ b/tests/lib/Authentication/Token/PublicKeyTokenTest.php @@ -0,0 +1,29 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace Test\Authentication\Token; + +use OC\Authentication\Token\PublicKeyToken; +use OCP\Authentication\Token\IToken; +use Test\TestCase; + +class PublicKeyTokenTest extends TestCase { + public function testSetScopeAsArray(): void { + $scope = [IToken::SCOPE_FILESYSTEM => false]; + $token = new PublicKeyToken(); + $token->setScope($scope); + $this->assertEquals(json_encode($scope), $token->getScope()); + $this->assertEquals($scope, $token->getScopeAsArray()); + } + + public function testDefaultScope(): void { + $scope = [IToken::SCOPE_FILESYSTEM => true]; + $token = new PublicKeyToken(); + $this->assertEquals($scope, $token->getScopeAsArray()); + } +} |