20 protected function _getServiceInstanceForMarkAsReadTest($notificationId)
26 $notificationFactory = $this->createPartialMock(
27 \
Magento\AdminNotification\Model\InboxFactory::class,
30 $notification = $this->createPartialMock(
31 \
Magento\AdminNotification\Model\Inbox::class,
32 [
'load',
'getId',
'save',
'setIsRead',
'__sleep',
'__wakeup']
34 $notification->expects($this->once())->method(
'load')->with($notificationId)->will($this->returnSelf());
35 $notification->expects($this->once())->method(
'getId')->will($this->returnValue($notificationId));
38 if ($notificationId) {
39 $notification->expects($this->once())->method(
'save')->will($this->returnSelf());
40 $notification->expects($this->once())->method(
'setIsRead')->with(1)->will($this->returnSelf());
43 $notificationFactory->expects($this->once())->method(
'create')->will($this->returnValue($notification));
44 return new \Magento\AdminNotification\Model\NotificationService($notificationFactory);
50 $service = $this->_getServiceInstanceForMarkAsReadTest($notificationId);
51 $service->markAsRead($notificationId);
60 $notificationId =
null;
61 $service = $this->_getServiceInstanceForMarkAsReadTest($notificationId);
62 $service->markAsRead($notificationId);
testMarkAsReadThrowsExceptionWhenNotificationIdIsInvalid()