diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-01-17 14:59:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-17 14:59:46 +0100 |
commit | 6e29b8731e25526442d9b878a5a6ae75afc4075e (patch) | |
tree | c946269570feb61b63387cdf0919dabcbd1d15e2 /tests/lib/Collaboration/Collaborators/UserPluginTest.php | |
parent | 24c58d39f4238f1068c629937a1a2baa37214068 (diff) | |
parent | 39f34603f20103a5fc44425175bf271e3fc91207 (diff) | |
download | nextcloud-server-6e29b8731e25526442d9b878a5a6ae75afc4075e.tar.gz nextcloud-server-6e29b8731e25526442d9b878a5a6ae75afc4075e.zip |
Merge pull request #7914 from nextcloud/fix-7254
format self-mentions, but don't offer them
Diffstat (limited to 'tests/lib/Collaboration/Collaborators/UserPluginTest.php')
-rw-r--r-- | tests/lib/Collaboration/Collaborators/UserPluginTest.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index 7d6d9c645a0..cfb97de8676 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -442,4 +442,51 @@ class UserPluginTest extends TestCase { $this->assertEquals($expected, $result['users']); $this->assertSame($reachedEnd, $moreResults); } + + public function takeOutCurrentUserProvider() { + $inputUsers = [ + 'alice' => 'Alice', + 'bob' => 'Bob', + 'carol' => 'Carol' + ]; + return [ + [ + $inputUsers, + ['alice', 'carol'], + 'bob' + ], + [ + $inputUsers, + ['alice', 'bob', 'carol'], + 'dave' + ], + [ + $inputUsers, + ['alice', 'bob', 'carol'], + null + ] + ]; + } + + /** + * @dataProvider takeOutCurrentUserProvider + * @param array $users + * @param array $expectedUIDs + * @param $currentUserId + */ + public function testTakeOutCurrentUser(array $users, array $expectedUIDs, $currentUserId) { + $this->instantiatePlugin(); + + $this->session->expects($this->once()) + ->method('getUser') + ->willReturnCallback(function() use ($currentUserId) { + if($currentUserId !== null) { + return $this->getUserMock($currentUserId, $currentUserId); + } + return null; + }); + + $this->plugin->takeOutCurrentUser($users); + $this->assertSame($expectedUIDs, array_keys($users)); + } } |