fixed more unit tests.

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-14 16:08:47 -04:00
committed by Julius Härtl
parent e0049cf07b
commit e8c53d71aa
2 changed files with 18 additions and 7 deletions

View File

@@ -33,6 +33,8 @@ use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper; use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCP\IUser; use OCP\IUser;
use OCP\IUserManager;
use OCP\IGroupManager;
use \Test\TestCase; use \Test\TestCase;
class BoardServiceTest extends TestCase { class BoardServiceTest extends TestCase {
@@ -53,6 +55,10 @@ class BoardServiceTest extends TestCase {
private $notificationHelper; private $notificationHelper;
/** @var AssignedUsersMapper */ /** @var AssignedUsersMapper */
private $assignedUsersMapper; private $assignedUsersMapper;
/** @var IUserManager */
private $userManager;
/** @var IUserManager */
private $groupManager;
private $userId = 'admin'; private $userId = 'admin';
@@ -65,6 +71,8 @@ class BoardServiceTest extends TestCase {
$this->permissionService = $this->createMock(PermissionService::class); $this->permissionService = $this->createMock(PermissionService::class);
$this->notificationHelper = $this->createMock(NotificationHelper::class); $this->notificationHelper = $this->createMock(NotificationHelper::class);
$this->assignedUsersMapper = $this->createMock(AssignedUsersMapper::class); $this->assignedUsersMapper = $this->createMock(AssignedUsersMapper::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->service = new BoardService( $this->service = new BoardService(
$this->boardMapper, $this->boardMapper,
@@ -73,7 +81,10 @@ class BoardServiceTest extends TestCase {
$this->aclMapper, $this->aclMapper,
$this->permissionService, $this->permissionService,
$this->notificationHelper, $this->notificationHelper,
$this->assignedUsersMapper $this->assignedUsersMapper,
$this->userManager,
$this->groupManager,
$this->userId
); );
$user = $this->createMock(IUser::class); $user = $this->createMock(IUser::class);
@@ -99,7 +110,7 @@ class BoardServiceTest extends TestCase {
'user' => 'admin', 'user' => 'admin',
'groups' => ['a', 'b', 'c'] 'groups' => ['a', 'b', 'c']
]; ];
$result = $this->service->findAll($userinfo); $result = $this->service->findAll();
sort($result); sort($result);
$this->assertEquals([$b1, $b2, $b3], $result); $this->assertEquals([$b1, $b2, $b3], $result);
} }

View File

@@ -336,8 +336,8 @@ class CardServiceTest extends TestCase {
->method('find') ->method('find')
->with(123) ->with(123)
->willReturn($assignments); ->willReturn($assignments);
$this->expectException(NotFoundException::class);
$actual = $this->cardService->unassignUser(123, 'user'); $actual = $this->cardService->unassignUser(123, 'user');
$this->assertEquals($assignment, $actual);
} }