From 476b15ee9d22e68b3580a1f12b8d479898ee1cf2 Mon Sep 17 00:00:00 2001 From: steav Date: Wed, 25 Jul 2018 23:44:31 +0200 Subject: [PATCH] Fix tests for card assignment notification Signed-off-by: steav --- .../Notification/NotificationHelperTest.php | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/unit/Notification/NotificationHelperTest.php b/tests/unit/Notification/NotificationHelperTest.php index ba6958345..c9c11bc70 100644 --- a/tests/unit/Notification/NotificationHelperTest.php +++ b/tests/unit/Notification/NotificationHelperTest.php @@ -188,23 +188,33 @@ class NotificationHelperTest extends \Test\TestCase { $board = new Board(); $board->setId(123); $board->setTitle('MyBoardTitle'); + $this->boardMapper->expects($this->once()) + ->method('find') + ->with(123) + ->willReturn($board); + $acl = new Acl(); $acl->setParticipant('admin'); $acl->setType(Acl::PERMISSION_TYPE_USER); + $card = new Card(); $card->setTitle('MyCardTitle'); - $card->setOwner('admin'); - $card->setStackId(123); - $card->setOrder(999); - $card->setType('text'); - $card->setId(1337); - $card->setAssignedUsers(['userA']); + $card->setOwner('admin'); + $card->setStackId(123); + $card->setOrder(999); + $card->setType('text'); + $card->setId(1337); + $card->setAssignedUsers(['userA']); + $this->cardMapper->expects($this->once()) + ->method('findBoardId') + ->with(1337) + ->willReturn(123); $notification = $this->createMock(INotification::class); $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('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); $this->notificationManager->expects($this->at(0))