diff --git a/tests/unit/Service/BoardServiceTest.php b/tests/unit/Service/BoardServiceTest.php index c7b89e79f..d2b42f43d 100644 --- a/tests/unit/Service/BoardServiceTest.php +++ b/tests/unit/Service/BoardServiceTest.php @@ -33,6 +33,8 @@ use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\LabelMapper; use OCA\Deck\Notification\NotificationHelper; use OCP\IUser; +use OCP\IUserManager; +use OCP\IGroupManager; use \Test\TestCase; class BoardServiceTest extends TestCase { @@ -53,8 +55,12 @@ class BoardServiceTest extends TestCase { private $notificationHelper; /** @var AssignedUsersMapper */ private $assignedUsersMapper; + /** @var IUserManager */ + private $userManager; + /** @var IUserManager */ + private $groupManager; - private $userId = 'admin'; + private $userId = 'admin'; public function setUp() { parent::setUp(); @@ -65,6 +71,8 @@ class BoardServiceTest extends TestCase { $this->permissionService = $this->createMock(PermissionService::class); $this->notificationHelper = $this->createMock(NotificationHelper::class); $this->assignedUsersMapper = $this->createMock(AssignedUsersMapper::class); + $this->userManager = $this->createMock(IUserManager::class); + $this->groupManager = $this->createMock(IGroupManager::class); $this->service = new BoardService( $this->boardMapper, @@ -73,11 +81,14 @@ class BoardServiceTest extends TestCase { $this->aclMapper, $this->permissionService, $this->notificationHelper, - $this->assignedUsersMapper + $this->assignedUsersMapper, + $this->userManager, + $this->groupManager, + $this->userId ); $user = $this->createMock(IUser::class); - $user->method('getUID')->willReturn('admin'); + $user->method('getUID')->willReturn('admin'); } public function testFindAll() { @@ -94,12 +105,12 @@ class BoardServiceTest extends TestCase { $this->boardMapper->expects($this->once()) ->method('findAllByGroups') ->with('admin', ['a', 'b', 'c']) - ->willReturn([$b2, $b3]); + ->willReturn([$b2, $b3]); $userinfo = [ 'user' => 'admin', 'groups' => ['a', 'b', 'c'] ]; - $result = $this->service->findAll($userinfo); + $result = $this->service->findAll(); sort($result); $this->assertEquals([$b1, $b2, $b3], $result); } diff --git a/tests/unit/Service/CardServiceTest.php b/tests/unit/Service/CardServiceTest.php index 65fc67257..b00c5889c 100644 --- a/tests/unit/Service/CardServiceTest.php +++ b/tests/unit/Service/CardServiceTest.php @@ -336,8 +336,8 @@ class CardServiceTest extends TestCase { ->method('find') ->with(123) ->willReturn($assignments); - $actual = $this->cardService->unassignUser(123, 'user'); - $this->assertEquals($assignment, $actual); + $this->expectException(NotFoundException::class); + $actual = $this->cardService->unassignUser(123, 'user'); }