diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-06-25 15:16:40 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2024-08-07 09:02:10 +0200 |
commit | 2b38d6ae7e0602d164bb26affa8a877b818e9cb5 (patch) | |
tree | 4917f090e30515b8c27f4eec5ae2492cfae1af40 /tests/lib/User | |
parent | fbbc10466b79caea0b9d1f718d4abdd021df241c (diff) | |
download | nextcloud-server-2b38d6ae7e0602d164bb26affa8a877b818e9cb5.tar.gz nextcloud-server-2b38d6ae7e0602d164bb26affa8a877b818e9cb5.zip |
fix(session): Log when session_* calls are slow
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/User')
-rw-r--r-- | tests/lib/User/SessionTest.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index 236da2a1dcc..84af7f552a7 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -114,7 +114,7 @@ class SessionTest extends \Test\TestCase { * @dataProvider isLoggedInData */ public function testIsLoggedIn($isLoggedIn) { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $manager = $this->createMock(Manager::class); @@ -132,7 +132,7 @@ class SessionTest extends \Test\TestCase { } public function testSetUser() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $session->expects($this->once()) ->method('set') ->with('user_id', 'foo'); @@ -151,7 +151,7 @@ class SessionTest extends \Test\TestCase { } public function testLoginValidPasswordEnabled() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $session->expects($this->once()) ->method('regenerateId'); $this->tokenProvider->expects($this->once()) @@ -228,7 +228,7 @@ class SessionTest extends \Test\TestCase { public function testLoginValidPasswordDisabled() { $this->expectException(LoginException::class); - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $session->expects($this->never()) ->method('set'); $session->expects($this->once()) @@ -270,7 +270,7 @@ class SessionTest extends \Test\TestCase { } public function testLoginInvalidPassword() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $managerMethods = get_class_methods(Manager::class); //keep following methods intact in order to ensure hooks are working $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); @@ -313,7 +313,7 @@ class SessionTest extends \Test\TestCase { } public function testPasswordlessLoginNoLastCheckUpdate(): void { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $managerMethods = get_class_methods(Manager::class); // Keep following methods intact in order to ensure hooks are working $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); @@ -350,7 +350,7 @@ class SessionTest extends \Test\TestCase { } public function testLoginLastCheckUpdate(): void { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $managerMethods = get_class_methods(Manager::class); // Keep following methods intact in order to ensure hooks are working $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); @@ -387,7 +387,7 @@ class SessionTest extends \Test\TestCase { } public function testLoginNonExisting() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $manager = $this->createMock(Manager::class); $userSession = new Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher); @@ -607,7 +607,7 @@ class SessionTest extends \Test\TestCase { } public function testRememberLoginValidToken() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $managerMethods = get_class_methods(Manager::class); //keep following methods intact in order to ensure hooks are working $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); @@ -696,7 +696,7 @@ class SessionTest extends \Test\TestCase { } public function testRememberLoginInvalidSessionToken() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $managerMethods = get_class_methods(Manager::class); //keep following methods intact in order to ensure hooks are working $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); @@ -760,7 +760,7 @@ class SessionTest extends \Test\TestCase { } public function testRememberLoginInvalidToken() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $managerMethods = get_class_methods(Manager::class); //keep following methods intact in order to ensure hooks are working $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); @@ -812,7 +812,7 @@ class SessionTest extends \Test\TestCase { } public function testRememberLoginInvalidUser() { - $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); + $session = $this->createMock(Memory::class); $managerMethods = get_class_methods(Manager::class); //keep following methods intact in order to ensure hooks are working $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); @@ -872,7 +872,7 @@ class SessionTest extends \Test\TestCase { return $users[$uid]; }); - $session = new Memory(''); + $session = new Memory(); $session->set('user_id', 'foo'); $userSession = $this->getMockBuilder(Session::class) ->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher]) @@ -885,7 +885,7 @@ class SessionTest extends \Test\TestCase { $this->assertEquals($users['foo'], $userSession->getUser()); - $session2 = new Memory(''); + $session2 = new Memory(); $session2->set('user_id', 'bar'); $userSession->setSession($session2); $this->assertEquals($users['bar'], $userSession->getUser()); |