2018-05-29 03:24:20 -04:00
|
|
|
<?php
|
2020-04-09 05:50:14 -04:00
|
|
|
|
2018-05-29 03:24:20 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
/**
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-05-29 03:24:20 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Test\Authentication\Token;
|
|
|
|
|
|
|
|
|
|
use OC\Authentication\Token\PublicKeyToken;
|
2024-03-15 07:51:31 -04:00
|
|
|
use OCP\Authentication\Token\IToken;
|
2018-05-29 03:24:20 -04:00
|
|
|
use Test\TestCase;
|
|
|
|
|
|
|
|
|
|
class PublicKeyTokenTest extends TestCase {
|
2024-09-15 16:32:31 -04:00
|
|
|
public function testSetScopeAsArray(): void {
|
2024-03-15 07:51:31 -04:00
|
|
|
$scope = [IToken::SCOPE_FILESYSTEM => false];
|
2018-05-29 03:24:20 -04:00
|
|
|
$token = new PublicKeyToken();
|
|
|
|
|
$token->setScope($scope);
|
|
|
|
|
$this->assertEquals(json_encode($scope), $token->getScope());
|
|
|
|
|
$this->assertEquals($scope, $token->getScopeAsArray());
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-15 16:32:31 -04:00
|
|
|
public function testDefaultScope(): void {
|
2024-03-15 07:51:31 -04:00
|
|
|
$scope = [IToken::SCOPE_FILESYSTEM => true];
|
2018-05-29 03:24:20 -04:00
|
|
|
$token = new PublicKeyToken();
|
|
|
|
|
$this->assertEquals($scope, $token->getScopeAsArray());
|
|
|
|
|
}
|
|
|
|
|
}
|