Fix tests for card assignment notification

Signed-off-by: steav <steav8@gmail.com>
This commit is contained in:
steav
2018-07-25 23:44:31 +02:00
committed by Julius Härtl
parent 9595e00ae1
commit 476b15ee9d

View File

@@ -188,9 +188,15 @@ class NotificationHelperTest extends \Test\TestCase {
$board = new Board(); $board = new Board();
$board->setId(123); $board->setId(123);
$board->setTitle('MyBoardTitle'); $board->setTitle('MyBoardTitle');
$this->boardMapper->expects($this->once())
->method('find')
->with(123)
->willReturn($board);
$acl = new Acl(); $acl = new Acl();
$acl->setParticipant('admin'); $acl->setParticipant('admin');
$acl->setType(Acl::PERMISSION_TYPE_USER); $acl->setType(Acl::PERMISSION_TYPE_USER);
$card = new Card(); $card = new Card();
$card->setTitle('MyCardTitle'); $card->setTitle('MyCardTitle');
$card->setOwner('admin'); $card->setOwner('admin');
@@ -199,12 +205,16 @@ class NotificationHelperTest extends \Test\TestCase {
$card->setType('text'); $card->setType('text');
$card->setId(1337); $card->setId(1337);
$card->setAssignedUsers(['userA']); $card->setAssignedUsers(['userA']);
$this->cardMapper->expects($this->once())
->method('findBoardId')
->with(1337)
->willReturn(123);
$notification = $this->createMock(INotification::class); $notification = $this->createMock(INotification::class);
$notification->expects($this->once())->method('setApp')->with('deck')->willReturn($notification); $notification->expects($this->once())->method('setApp')->with('deck')->willReturn($notification);
$notification->expects($this->once())->method('setUser')->with('userA')->willReturn($notification); $notification->expects($this->once())->method('setUser')->with('userA')->willReturn($notification);
$notification->expects($this->once())->method('setObject')->with('card', 1337)->willReturn($notification); $notification->expects($this->once())->method('setObject')->with('card', 1337)->willReturn($notification);
$notification->expects($this->once())->method('setSubject')->with('card-assigned', ['MyCardTitle', 'userA', 'admin'])->willReturn($notification); $notification->expects($this->once())->method('setSubject')->with('card-assigned', ['MyCardTitle', 'MyBoardTitle', 'admin'])->willReturn($notification);
$notification->expects($this->once())->method('setDateTime')->willReturn($notification); $notification->expects($this->once())->method('setDateTime')->willReturn($notification);
$this->notificationManager->expects($this->at(0)) $this->notificationManager->expects($this->at(0))