From f6d18f8303882a43510d67c787410aec7c8e28e8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 13 Sep 2022 16:52:44 +0200 Subject: perf: merge last_activity and last_check updates the debounce for updating last_activity is changed so it always updates if another field of the token has been updated, this ensures that last_check if updated even if last_activity is still in the debounce period. Signed-off-by: Robin Appelman --- .../Token/PublicKeyTokenProviderTest.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php') diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index 3c81eade700..5f0f65e2cc9 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -191,8 +191,6 @@ class PublicKeyTokenProviderTest extends TestCase { ]); $this->tokenProvider->updateTokenActivity($tk); - - $this->assertEquals($this->time, $tk->getLastActivity()); } public function testUpdateTokenDebounce() { @@ -210,6 +208,22 @@ class PublicKeyTokenProviderTest extends TestCase { $this->tokenProvider->updateTokenActivity($tk); } + public function testUpdateTokenDebounceWithUpdatedFields() { + $tk = new PublicKeyToken(); + $this->config->method('getSystemValueInt') + ->willReturnCallback(function ($value, $default) { + return $default; + }); + $tk->setLastActivity($this->time - 30); + $tk->setLastCheck($this->time - 30); + + $this->mapper->expects($this->once()) + ->method('updateActivity') + ->with($tk, $this->time); + + $this->tokenProvider->updateTokenActivity($tk); + } + public function testGetTokenByUser() { $this->mapper->expects($this->once()) ->method('getTokenByUser') -- cgit v1.2.3