2626use OC \L10N \L10N ;
2727use OCA \Deck \Db \Acl ;
2828use OCA \Deck \Db \AclMapper ;
29+ use OCA \Deck \Db \AssignedUsers ;
30+ use OCA \Deck \Db \AssignedUsersMapper ;
2931use OCA \Deck \Db \Board ;
3032use OCA \Deck \Db \BoardMapper ;
3133use OCA \Deck \Db \LabelMapper ;
@@ -49,6 +51,8 @@ class BoardServiceTest extends TestCase {
4951 private $ permissionService ;
5052 /** @var NotificationHelper */
5153 private $ notificationHelper ;
54+ /** @var AssignedUsersMapper */
55+ private $ assignedUsersMapper ;
5256
5357 private $ userId = 'admin ' ;
5458
@@ -60,14 +64,16 @@ public function setUp() {
6064 $ this ->labelMapper = $ this ->createMock (LabelMapper::class);
6165 $ this ->permissionService = $ this ->createMock (PermissionService::class);
6266 $ this ->notificationHelper = $ this ->createMock (NotificationHelper::class);
67+ $ this ->assignedUsersMapper = $ this ->createMock (AssignedUsersMapper::class);
6368
6469 $ this ->service = new BoardService (
6570 $ this ->boardMapper ,
6671 $ this ->l10n ,
6772 $ this ->labelMapper ,
6873 $ this ->aclMapper ,
6974 $ this ->permissionService ,
70- $ this ->notificationHelper
75+ $ this ->notificationHelper ,
76+ $ this ->assignedUsersMapper
7177 );
7278
7379 $ user = $ this ->createMock (IUser::class);
@@ -224,7 +230,7 @@ public function testUpdateAcl() {
224230 public function testDeleteAcl () {
225231 $ acl = new Acl ();
226232 $ acl ->setBoardId (123 );
227- $ acl ->setType (' user ' );
233+ $ acl ->setType (Acl:: PERMISSION_TYPE_USER );
228234 $ acl ->setParticipant ('admin ' );
229235 $ acl ->setPermissionEdit (true );
230236 $ acl ->setPermissionShare (true );
@@ -233,6 +239,15 @@ public function testDeleteAcl() {
233239 ->method ('find ' )
234240 ->with (123 )
235241 ->willReturn ($ acl );
242+ $ assignment = new AssignedUsers ();
243+ $ assignment ->setParticipant ('admin ' );
244+ $ this ->assignedUsersMapper ->expects ($ this ->once ())
245+ ->method ('findByUserId ' )
246+ ->with ('admin ' )
247+ ->willReturn ([$ assignment ]);
248+ $ this ->assignedUsersMapper ->expects ($ this ->once ())
249+ ->method ('delete ' )
250+ ->with ($ assignment );
236251 $ this ->aclMapper ->expects ($ this ->once ())
237252 ->method ('delete ' )
238253 ->with ($ acl )
0 commit comments