Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-05 14:06:10 +0300
committerJoas Schilling <coding@schilljs.com>2022-10-05 14:06:10 +0300
commita2c918c379c5fbfb88374a01c43c87a6ad47e28b (patch)
tree14a14030b29c750c4f640cf7ee822363497d8693
parent5f060687c8a0c77f1a61bf9a3462d4bfa4fe055f (diff)
Refactor unit test to work again
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--tests/php/Collaboration/Collaborators/RoomPluginTest.php94
1 files changed, 50 insertions, 44 deletions
diff --git a/tests/php/Collaboration/Collaborators/RoomPluginTest.php b/tests/php/Collaboration/Collaborators/RoomPluginTest.php
index aea191ecd..c35b176f7 100644
--- a/tests/php/Collaboration/Collaborators/RoomPluginTest.php
+++ b/tests/php/Collaboration/Collaborators/RoomPluginTest.php
@@ -119,73 +119,73 @@ class RoomPluginTest extends TestCase {
// Empty search term with rooms
['', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Room name')
+ [Room::TYPE_GROUP, 'roomToken', 'Room name'],
], [], [], false],
// Search term with no matches
['Unmatched search term', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Unmatched name')
+ [Room::TYPE_GROUP, 'roomToken', 'Unmatched name'],
], [], [], false],
// Search term with single wide match
['room', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken2', 'Unmatched name')
+ [Room::TYPE_GROUP, 'roomToken', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken2', 'Unmatched name'],
], [], [
- $this->newResult('Room name', 'roomToken')
+ $this->newResult('Room name', 'roomToken'),
], false],
// Chats without chat permission are not returned
['room', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Room name', Attendee::PERMISSIONS_MAX_DEFAULT ^ Attendee::PERMISSIONS_CHAT),
+ [Room::TYPE_GROUP, 'roomToken', 'Room name', Attendee::PERMISSIONS_MAX_DEFAULT ^ Attendee::PERMISSIONS_CHAT],
], [], [], false],
// Search term with single exact match
['room name', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Unmatched name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken2', 'Room name')
+ [Room::TYPE_GROUP, 'roomToken', 'Unmatched name'],
+ [Room::TYPE_GROUP, 'roomToken2', 'Room name'],
], [
- $this->newResult('Room name', 'roomToken2')
+ $this->newResult('Room name', 'roomToken2'),
], [], false],
// Search term with single exact match and single wide match
['room name', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Room name that also matches'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken2', 'Room name')
+ [Room::TYPE_GROUP, 'roomToken', 'Room name that also matches'],
+ [Room::TYPE_GROUP, 'roomToken2', 'Room name'],
], [
- $this->newResult('Room name', 'roomToken2')
+ $this->newResult('Room name', 'roomToken2'),
], [
- $this->newResult('Room name that also matches', 'roomToken')
+ $this->newResult('Room name that also matches', 'roomToken'),
], false],
// Search term matching one-to-one rooms (not possible in practice
// as one-to-one rooms do not have a name, but it would be if they
// had, so it is included here for completeness).
['room name', 2, 0, [
- $this->newRoom(Room::TYPE_ONE_TO_ONE, 'roomToken', 'Room name that also matches'),
- $this->newRoom(Room::TYPE_ONE_TO_ONE, 'roomToken2', 'Room name')
+ [Room::TYPE_ONE_TO_ONE, 'roomToken', 'Room name that also matches'],
+ [Room::TYPE_ONE_TO_ONE, 'roomToken2', 'Room name'],
], [
- $this->newResult('Room name', 'roomToken2')
+ $this->newResult('Room name', 'roomToken2'),
], [
- $this->newResult('Room name that also matches', 'roomToken')
+ $this->newResult('Room name that also matches', 'roomToken'),
], false],
// Search term matching public rooms
['room name', 2, 0, [
- $this->newRoom(Room::TYPE_PUBLIC, 'roomToken', 'Room name that also matches'),
- $this->newRoom(Room::TYPE_PUBLIC, 'roomToken2', 'Room name')
+ [Room::TYPE_PUBLIC, 'roomToken', 'Room name that also matches'],
+ [Room::TYPE_PUBLIC, 'roomToken2', 'Room name'],
], [
- $this->newResult('Room name', 'roomToken2')
+ $this->newResult('Room name', 'roomToken2'),
], [
- $this->newResult('Room name that also matches', 'roomToken')
+ $this->newResult('Room name that also matches', 'roomToken'),
], false],
// Search term with several wide matches
['room', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken2', 'Another room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken3', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken4', 'Another room name')
+ [Room::TYPE_GROUP, 'roomToken', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken2', 'Another room name'],
+ [Room::TYPE_GROUP, 'roomToken3', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken4', 'Another room name'],
], [], [
$this->newResult('Room name', 'roomToken'),
$this->newResult('Another room name', 'roomToken2'),
@@ -195,39 +195,39 @@ class RoomPluginTest extends TestCase {
// Search term with several exact matches
['room name', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken2', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken3', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken4', 'Room name')
+ [Room::TYPE_GROUP, 'roomToken', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken2', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken3', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken4', 'Room name'],
], [
$this->newResult('Room name', 'roomToken'),
$this->newResult('Room name', 'roomToken2'),
$this->newResult('Room name', 'roomToken3'),
- $this->newResult('Room name', 'roomToken4')
+ $this->newResult('Room name', 'roomToken4'),
], [], false],
// Search term with several matches
['room name', 2, 0, [
- $this->newRoom(Room::TYPE_GROUP, 'roomToken', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken2', 'Unmatched name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken3', 'Another room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken4', 'Room name'),
- $this->newRoom(Room::TYPE_ONE_TO_ONE, 'roomToken5', 'Room name'),
- $this->newRoom(Room::TYPE_PUBLIC, 'roomToken6', 'Room name'),
- $this->newRoom(Room::TYPE_GROUP, 'roomToken7', 'Another unmatched name'),
- $this->newRoom(Room::TYPE_ONE_TO_ONE, 'roomToken8', 'Another unmatched name'),
- $this->newRoom(Room::TYPE_PUBLIC, 'roomToken9', 'Another unmatched name'),
- $this->newRoom(Room::TYPE_ONE_TO_ONE, 'roomToken10', 'Another room name'),
- $this->newRoom(Room::TYPE_PUBLIC, 'roomToken11', 'Another room name')
+ [Room::TYPE_GROUP, 'roomToken', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken2', 'Unmatched name'],
+ [Room::TYPE_GROUP, 'roomToken3', 'Another room name'],
+ [Room::TYPE_GROUP, 'roomToken4', 'Room name'],
+ [Room::TYPE_ONE_TO_ONE, 'roomToken5', 'Room name'],
+ [Room::TYPE_PUBLIC, 'roomToken6', 'Room name'],
+ [Room::TYPE_GROUP, 'roomToken7', 'Another unmatched name'],
+ [Room::TYPE_ONE_TO_ONE, 'roomToken8', 'Another unmatched name'],
+ [Room::TYPE_PUBLIC, 'roomToken9', 'Another unmatched name'],
+ [Room::TYPE_ONE_TO_ONE, 'roomToken10', 'Another room name'],
+ [Room::TYPE_PUBLIC, 'roomToken11', 'Another room name'],
], [
$this->newResult('Room name', 'roomToken'),
$this->newResult('Room name', 'roomToken4'),
$this->newResult('Room name', 'roomToken5'),
- $this->newResult('Room name', 'roomToken6')
+ $this->newResult('Room name', 'roomToken6'),
], [
$this->newResult('Another room name', 'roomToken3'),
$this->newResult('Another room name', 'roomToken10'),
- $this->newResult('Another room name', 'roomToken11')
+ $this->newResult('Another room name', 'roomToken11'),
], false],
];
}
@@ -252,10 +252,16 @@ class RoomPluginTest extends TestCase {
array $expectedMatches,
bool $expectedHasMoreResults
) {
+
+ $rooms = [];
+ foreach ($roomsForParticipant as $roomData) {
+ $rooms[] = call_user_func_array([$this, 'newRoom'], $roomData);
+ }
+
$this->manager->expects($this->any())
->method('getRoomsForUser')
->with('user0')
- ->willReturn($roomsForParticipant);
+ ->willReturn($rooms);
$this->searchResult->expects($this->any())
->method('addResultSet')