diff options
Diffstat (limited to 'apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php')
-rw-r--r-- | apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php | 81 |
1 files changed, 37 insertions, 44 deletions
diff --git a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php index 44641ee98b3..0a0ff4d84af 100644 --- a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php +++ b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php @@ -20,24 +20,12 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class AuthtokensTest extends TestCase { - - /** @var IAuthTokenProvider|MockObject */ - private $authTokenProvider; - - /** @var ISession|MockObject */ - private $session; - - /** @var IUserSession|MockObject */ - private $userSession; - - /** @var IInitialState|MockObject */ - private $initialState; - - /** @var string */ - private $uid; - - /** @var Authtokens */ - private $section; + private IAuthTokenProvider&MockObject $authTokenProvider; + private ISession&MockObject $session; + private IUserSession&MockObject $userSession; + private IInitialState&MockObject $initialState; + private string $uid; + private Authtokens $section; protected function setUp(): void { parent::setUp(); @@ -80,34 +68,39 @@ class AuthtokensTest extends TestCase { ->method('getToken') ->with('session123') ->willReturn($sessionToken); + + $calls = [ + [ + 'app_tokens', [ + [ + 'id' => 100, + 'name' => null, + 'lastActivity' => 0, + 'type' => 0, + 'canDelete' => false, + 'current' => true, + 'scope' => [IToken::SCOPE_FILESYSTEM => true], + 'canRename' => false, + ], + [ + 'id' => 200, + 'name' => null, + 'lastActivity' => 0, + 'type' => 0, + 'canDelete' => true, + 'scope' => [IToken::SCOPE_FILESYSTEM => true], + 'canRename' => true, + ], + ] + ], + ['can_create_app_token', true], + ]; $this->initialState->expects($this->exactly(2)) ->method('provideInitialState') - ->withConsecutive( - [ - 'app_tokens', [ - [ - 'id' => 100, - 'name' => null, - 'lastActivity' => 0, - 'type' => 0, - 'canDelete' => false, - 'current' => true, - 'scope' => [IToken::SCOPE_FILESYSTEM => true], - 'canRename' => false, - ], - [ - 'id' => 200, - 'name' => null, - 'lastActivity' => 0, - 'type' => 0, - 'canDelete' => true, - 'scope' => [IToken::SCOPE_FILESYSTEM => true], - 'canRename' => true, - ], - ] - ], - ['can_create_app_token', true], - ); + ->willReturnCallback(function () use (&$calls): void { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); $form = $this->section->getForm(); |