diff options
-rw-r--r-- | apps/files/lib/activityhelper.php | 2 | ||||
-rw-r--r-- | apps/files/tests/activitytest.php | 2 | ||||
-rw-r--r-- | lib/private/allconfig.php | 2 | ||||
-rw-r--r-- | lib/private/server.php | 2 | ||||
-rw-r--r-- | lib/public/iconfig.php | 2 | ||||
-rw-r--r-- | lib/public/iservercontainer.php | 2 | ||||
-rw-r--r-- | tests/lib/activitymanager.php | 27 |
7 files changed, 16 insertions, 23 deletions
diff --git a/apps/files/lib/activityhelper.php b/apps/files/lib/activityhelper.php index e05ae6c9831..f9ff722b1c2 100644 --- a/apps/files/lib/activityhelper.php +++ b/apps/files/lib/activityhelper.php @@ -60,7 +60,7 @@ class ActivityHelper { $folders = $items = []; foreach ($favorites as $favorite) { $nodes = $rootFolder->getById($favorite); - if ($nodes) { + if (!empty($nodes)) { /** @var \OCP\Files\Node $node */ $node = array_shift($nodes); $path = substr($node->getPath(), strlen($user . '/files/')); diff --git a/apps/files/tests/activitytest.php b/apps/files/tests/activitytest.php index b8766f95224..1f8d6330e51 100644 --- a/apps/files/tests/activitytest.php +++ b/apps/files/tests/activitytest.php @@ -95,7 +95,7 @@ class ActivityTest extends TestCase { public function testTranslate() { $this->assertFalse( - $this->activityExtension->translate('files_sharing', '', '', array(), false, false, 'en'), + $this->activityExtension->translate('files_sharing', '', [], false, false, 'en'), 'Asserting that no translations are set for files_sharing' ); } diff --git a/lib/private/allconfig.php b/lib/private/allconfig.php index df75a332a13..63cc92601bb 100644 --- a/lib/private/allconfig.php +++ b/lib/private/allconfig.php @@ -253,7 +253,7 @@ class AllConfig implements \OCP\IConfig { * @param string $userId the userId of the user that we want to store the value under * @param string $appName the appName that we stored the value under * @param string $key the key under which the value is being stored - * @param string $default the default value to be returned if the value isn't set + * @param mixed $default the default value to be returned if the value isn't set * @return string */ public function getUserValue($userId, $appName, $key, $default = '') { diff --git a/lib/private/server.php b/lib/private/server.php index 6b212ee94a4..02d649585d6 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -425,7 +425,7 @@ class Server extends SimpleContainer implements IServerContainer { * currently being processed is returned from this method. * In case the current execution was not initiated by a web request null is returned * - * @return \OCP\IRequest|null + * @return \OCP\IRequest */ function getRequest() { return $this->query('Request'); diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php index c63ba1a90a6..f28a114a2bb 100644 --- a/lib/public/iconfig.php +++ b/lib/public/iconfig.php @@ -133,7 +133,7 @@ interface IConfig { * @param string $userId the userId of the user that we want to store the value under * @param string $appName the appName that we stored the value under * @param string $key the key under which the value is being stored - * @param string $default the default value to be returned if the value isn't set + * @param mixed $default the default value to be returned if the value isn't set * @return string */ public function getUserValue($userId, $appName, $key, $default = ''); diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index d7df884adf8..f11a5c0133f 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -59,7 +59,7 @@ interface IServerContainer { * is returned from this method. * In case the current execution was not initiated by a web request null is returned * - * @return \OCP\IRequest|null + * @return \OCP\IRequest */ function getRequest(); diff --git a/tests/lib/activitymanager.php b/tests/lib/activitymanager.php index 51ab4a7a947..d3263fa2ede 100644 --- a/tests/lib/activitymanager.php +++ b/tests/lib/activitymanager.php @@ -155,17 +155,7 @@ class Test_ActivityManager extends \Test\TestCase { * @param array $users */ public function testGetUserFromTokenThrowInvalidToken($token, $users) { - if ($token !== null) { - $this->request->expects($this->any()) - ->method('getParam') - ->with('token', '') - ->willReturn($token); - } - $this->config->expects($this->any()) - ->method('getUsersForUserValue') - ->with('activity', 'rsstoken', $token) - ->willReturn($users); - + $this->mockRSSToken($token, $token, $users); \Test_Helper::invokePrivate($this->activityManager, 'getUserFromToken'); } @@ -188,20 +178,23 @@ class Test_ActivityManager extends \Test\TestCase { if ($userLoggedIn !== null) { $this->mockUserSession($userLoggedIn); } + $this->mockRSSToken($token, '123456789012345678901234567890', ['user1']); + + $this->assertEquals($expected, $this->activityManager->getCurrentUserId()); + } - if ($token !== null) { + protected function mockRSSToken($requestToken, $userToken, $users) { + if ($requestToken !== null) { $this->request->expects($this->any()) ->method('getParam') ->with('token', '') - ->willReturn($token); + ->willReturn($requestToken); } $this->config->expects($this->any()) ->method('getUsersForUserValue') - ->with('activity', 'rsstoken', '123456789012345678901234567890') - ->willReturn(['user1']); - - $this->assertEquals($expected, $this->activityManager->getCurrentUserId()); + ->with('activity', 'rsstoken', $userToken) + ->willReturn($users); } protected function mockUserSession($user) { |