summaryrefslogtreecommitdiffstats
path: root/tests/lib/activitymanager.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/activitymanager.php')
-rw-r--r--tests/lib/activitymanager.php27
1 files changed, 10 insertions, 17 deletions
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) {