Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Mar 2, 2018
1 parent 9273d15 commit cae999e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/unit/Service/BoardServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
use OC\L10N\L10N;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignedUsers;
use OCA\Deck\Db\AssignedUsersMapper;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
Expand All @@ -49,6 +51,8 @@ class BoardServiceTest extends TestCase {
private $permissionService;
/** @var NotificationHelper */
private $notificationHelper;
/** @var AssignedUsersMapper */
private $assignedUsersMapper;

private $userId = 'admin';

Expand All @@ -60,14 +64,16 @@ public function setUp() {
$this->labelMapper = $this->createMock(LabelMapper::class);
$this->permissionService = $this->createMock(PermissionService::class);
$this->notificationHelper = $this->createMock(NotificationHelper::class);
$this->assignedUsersMapper = $this->createMock(AssignedUsersMapper::class);

$this->service = new BoardService(
$this->boardMapper,
$this->l10n,
$this->labelMapper,
$this->aclMapper,
$this->permissionService,
$this->notificationHelper
$this->notificationHelper,
$this->assignedUsersMapper
);

$user = $this->createMock(IUser::class);
Expand Down Expand Up @@ -224,7 +230,7 @@ public function testUpdateAcl() {
public function testDeleteAcl() {
$acl = new Acl();
$acl->setBoardId(123);
$acl->setType('user');
$acl->setType(Acl::PERMISSION_TYPE_USER);
$acl->setParticipant('admin');
$acl->setPermissionEdit(true);
$acl->setPermissionShare(true);
Expand All @@ -233,6 +239,15 @@ public function testDeleteAcl() {
->method('find')
->with(123)
->willReturn($acl);
$assignment = new AssignedUsers();
$assignment->setParticipant('admin');
$this->assignedUsersMapper->expects($this->once())
->method('findByUserId')
->with('admin')
->willReturn([$assignment]);
$this->assignedUsersMapper->expects($this->once())
->method('delete')
->with($assignment);
$this->aclMapper->expects($this->once())
->method('delete')
->with($acl)
Expand Down

0 comments on commit cae999e

Please sign in to comment.