@@ -276,6 +276,10 @@ private function createStack(int $id, int $order) {
276276
277277 public function testSetDoneStackSetsDoneColumn (): void {
278278 $ this ->permissionService ->expects ($ this ->once ())->method ('checkPermission ' );
279+ $ this ->stackMapper ->expects ($ this ->once ())
280+ ->method ('find ' )
281+ ->with (5 )
282+ ->willReturn ($ this ->createStack (5 , 0 ));
279283 $ this ->boardService ->expects ($ this ->once ())->method ('isArchived ' )->willReturn (false );
280284 $ this ->stackMapper ->expects ($ this ->once ())
281285 ->method ('clearDoneColumnForBoard ' )
@@ -303,6 +307,10 @@ public function testSetDoneStackSetsDoneColumn(): void {
303307 public function testSetDoneStackDoesNotMarkCardsWhenUnsetting (): void {
304308 $ this ->permissionService ->expects ($ this ->once ())->method ('checkPermission ' );
305309 $ this ->boardService ->expects ($ this ->once ())->method ('isArchived ' )->willReturn (false );
310+ $ this ->stackMapper ->expects ($ this ->once ())
311+ ->method ('find ' )
312+ ->with (5 )
313+ ->willReturn ($ this ->createStack (5 , 0 ));
306314 $ this ->stackMapper ->expects ($ this ->never ())->method ('clearDoneColumnForBoard ' );
307315 $ this ->cardMapper ->expects ($ this ->never ())->method ('findAll ' );
308316 $ this ->cardMapper ->expects ($ this ->never ())->method ('update ' );
@@ -314,9 +322,24 @@ public function testSetDoneStackDoesNotMarkCardsWhenUnsetting(): void {
314322
315323 public function testSetDoneStackThrowsOnArchivedBoard (): void {
316324 $ this ->permissionService ->expects ($ this ->once ())->method ('checkPermission ' );
325+ $ this ->stackMapper ->expects ($ this ->once ())
326+ ->method ('find ' )
327+ ->with (5 )
328+ ->willReturn ($ this ->createStack (5 , 0 ));
317329 $ this ->boardService ->expects ($ this ->once ())->method ('isArchived ' )->willReturn (true );
318330 $ this ->stackMapper ->expects ($ this ->never ())->method ('setIsDoneColumn ' );
319331 $ this ->expectException (\OCA \Deck \NoPermissionException::class);
320332 $ this ->stackService ->setDoneStack (5 , 1 , true );
321333 }
334+
335+ public function testSetDoneStackThrowsOnMismatchBoardId (): void {
336+ $ this ->permissionService ->expects ($ this ->once ())->method ('checkPermission ' );
337+ $ this ->stackMapper ->expects ($ this ->once ())
338+ ->method ('find ' )
339+ ->with (5 )
340+ ->willReturn ($ this ->createStack (5 , 0 ));
341+ $ this ->stackMapper ->expects ($ this ->never ())->method ('setIsDoneColumn ' );
342+ $ this ->expectException (\OCA \Deck \BadRequestException::class);
343+ $ this ->stackService ->setDoneStack (5 , 2 , true );
344+ }
322345}
0 commit comments