PublicKeyTokenTest.php 813 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace Test\Authentication\Token;
  8. use OC\Authentication\Token\PublicKeyToken;
  9. use OCP\Authentication\Token\IToken;
  10. use Test\TestCase;
  11. class PublicKeyTokenTest extends TestCase {
  12. public function testSetScopeAsArray(): void {
  13. $scope = [IToken::SCOPE_FILESYSTEM => false];
  14. $token = new PublicKeyToken();
  15. $token->setScope($scope);
  16. $this->assertEquals(json_encode($scope), $token->getScope());
  17. $this->assertEquals($scope, $token->getScopeAsArray());
  18. }
  19. public function testDefaultScope(): void {
  20. $scope = [IToken::SCOPE_FILESYSTEM => true];
  21. $token = new PublicKeyToken();
  22. $this->assertEquals($scope, $token->getScopeAsArray());
  23. }
  24. }