Skip to content

Commit a461699

Browse files
committed
Adjust rename in tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent f031717 commit a461699

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

lib/Db/AssignmentMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function mapParticipant(Assignment $assignment): void {
114114
}
115115

116116
public function isUserAssigned($cardId, $userId): bool {
117-
$assignments = $this->find($cardId);
117+
$assignments = $this->findAll($cardId);
118118
foreach ($assignments as $assignment) {
119119
$origin = $this->getOrigin($assignment);
120120
if ($origin instanceof User && $assignment->getParticipant() === $userId) {

lib/Notification/NotificationHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
use DateTime;
2727
use OCA\Deck\AppInfo\Application;
2828
use OCA\Deck\Db\Acl;
29-
use OCA\Deck\Db\AssignedUsersMapper;
29+
use OCA\Deck\Db\AssignmentMapper;
3030
use OCA\Deck\Db\Board;
3131
use OCA\Deck\Db\BoardMapper;
3232
use OCA\Deck\Db\CardMapper;
@@ -44,8 +44,8 @@ class NotificationHelper {
4444
protected $cardMapper;
4545
/** @var BoardMapper */
4646
protected $boardMapper;
47-
/** @var AssignedUsersMapper */
48-
protected $assignedUsersMapper;
47+
/** @var AssignmentMapper */
48+
protected $assignmentMapper;
4949
/** @var PermissionService */
5050
protected $permissionService;
5151
/** @var IConfig */
@@ -62,7 +62,7 @@ class NotificationHelper {
6262
public function __construct(
6363
CardMapper $cardMapper,
6464
BoardMapper $boardMapper,
65-
AssignedUsersMapper $assignedUsersMapper,
65+
AssignmentMapper $assignmentMapper,
6666
PermissionService $permissionService,
6767
IConfig $config,
6868
IManager $notificationManager,
@@ -71,7 +71,7 @@ public function __construct(
7171
) {
7272
$this->cardMapper = $cardMapper;
7373
$this->boardMapper = $boardMapper;
74-
$this->assignedUsersMapper = $assignedUsersMapper;
74+
$this->assignmentMapper = $assignmentMapper;
7575
$this->permissionService = $permissionService;
7676
$this->config = $config;
7777
$this->notificationManager = $notificationManager;
@@ -107,7 +107,7 @@ public function sendCardDuedate($card) {
107107
if ($user->getUID() === $board->getOwner() && count($board->getAcl()) === 0) {
108108
// Notify if all or assigned is configured for unshared boards
109109
$shouldNotify = true;
110-
} elseif ($notificationSetting === ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED && $this->assignedUsersMapper->isUserAssigned($card->getId(), $user->getUID())) {
110+
} elseif ($notificationSetting === ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED && $this->assignmentMapper->isUserAssigned($card->getId(), $user->getUID())) {
111111
// Notify if the user is assigned and has the assigned setting selected
112112
$shouldNotify = true;
113113
}

tests/integration/database/AssignmentMapperTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function testInsertInvalidUser() {
165165
$assignment = new Assignment();
166166
$assignment->setCardId($this->cards[1]->getId());
167167
$assignment->setParticipant('invalid-username');
168-
$assignment->setType(AssignedUsers::TYPE_USER);
168+
$assignment->setType(Assignment::TYPE_USER);
169169
$this->expectException(NotFoundException::class);
170170
$this->assignedUsersMapper->insert($assignment);
171171
}
@@ -190,10 +190,10 @@ public function testMapParticipant() {
190190
}
191191

192192
public function testIsUserAssigned() {
193-
$assignment = new AssignedUsers();
193+
$assignment = new Assignment();
194194
$assignment->setCardId($this->cards[1]->getId());
195195
$assignment->setParticipant(self::TEST_USER4);
196-
$assignment->setType(AssignedUsers::TYPE_USER);
196+
$assignment->setType(Assignment::TYPE_USER);
197197
$this->assertFalse($this->assignedUsersMapper->isUserAssigned($this->cards[1]->getId(), self::TEST_USER4));
198198

199199
$assignment = $this->assignedUsersMapper->insert($assignment);
@@ -205,10 +205,10 @@ public function testIsUserAssigned() {
205205
}
206206

207207
public function testIsUserAssignedGroup() {
208-
$assignment = new AssignedUsers();
208+
$assignment = new Assignment();
209209
$assignment->setCardId($this->cards[1]->getId());
210210
$assignment->setParticipant('group');
211-
$assignment->setType(AssignedUsers::TYPE_GROUP);
211+
$assignment->setType(Assignment::TYPE_GROUP);
212212
$this->assertFalse($this->assignedUsersMapper->isUserAssigned($this->cards[1]->getId(), self::TEST_USER1));
213213
$this->assertFalse($this->assignedUsersMapper->isUserAssigned($this->cards[1]->getId(), self::TEST_USER2));
214214
$this->assertFalse($this->assignedUsersMapper->isUserAssigned($this->cards[1]->getId(), self::TEST_USER3));

tests/unit/Service/AssignmentServiceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function mockActivity($type, $object, $subject) {
115115
public function testAssignUser() {
116116
$assignments = [];
117117
$this->assignedUsersMapper->expects($this->once())
118-
->method('find')
118+
->method('findAll')
119119
->with(123)
120120
->willReturn($assignments);
121121
$assignment = new Assignment();
@@ -145,7 +145,7 @@ public function testAssignUserNoParticipant() {
145145
$this->expectExceptionMessage('The user is not part of the board');
146146
$assignments = [];
147147
$this->assignedUsersMapper->expects($this->once())
148-
->method('find')
148+
->method('findAll')
149149
->with(123)
150150
->willReturn($assignments);
151151
$assignment = new Assignment();
@@ -176,7 +176,7 @@ public function testAssignUserExisting() {
176176
$assignment
177177
];
178178
$this->assignedUsersMapper->expects($this->once())
179-
->method('find')
179+
->method('findAll')
180180
->with(123)
181181
->willReturn($assignments);
182182
$actual = $this->assignmentService->assignUser(123, 'admin');
@@ -192,7 +192,7 @@ public function testUnassignUserExisting() {
192192
$assignment
193193
];
194194
$this->assignedUsersMapper->expects($this->once())
195-
->method('find')
195+
->method('findAll')
196196
->with(123)
197197
->willReturn($assignments);
198198
$this->assignedUsersMapper->expects($this->once())
@@ -213,7 +213,7 @@ public function testUnassignUserNotExisting() {
213213
$assignment
214214
];
215215
$this->assignedUsersMapper->expects($this->once())
216-
->method('find')
216+
->method('findAll')
217217
->with(123)
218218
->willReturn($assignments);
219219
$this->expectException(NotFoundException::class);

0 commit comments

Comments
 (0)