/** * Test case when Mail Exception has been thrown */ public function testNotifyException() { $exception = new MailException(__('Email has not been sent')); $this->creditmemoSenderMock->expects($this->once())->method('send')->with($this->equalTo($this->creditmemo))->will($this->throwException($exception)); $this->loggerMock->expects($this->once())->method('critical')->with($this->equalTo($exception)); $this->assertFalse($this->notifier->notify($this->creditmemo)); }
/** * Notify user * * @param int $id * @return bool */ public function notify($id) { $creditmemo = $this->creditmemoRepository->get($id); return $this->creditmemoNotifier->notify($creditmemo); }
/** * Invoke notifyUser service * * @param int $id * @return bool */ public function invoke($id) { /** @var \Magento\Sales\Model\Order\Creditmemo $creditmemo */ $creditmemo = $this->creditmemoRepository->get($id); return $this->creditmemoNotifier->notify($creditmemo); }