コード例 #1
0
 /**
  * Test case when Mail Exception has been thrown
  */
 public function testNotifyException()
 {
     $exception = new MailException(__('Email has not been sent'));
     $this->orderSenderMock->expects($this->once())->method('send')->with($this->equalTo($this->order))->will($this->throwException($exception));
     $this->loggerMock->expects($this->once())->method('critical')->with($this->equalTo($exception));
     $this->assertFalse($this->notifier->notify($this->order));
 }
コード例 #2
0
 /**
  * Notify user
  *
  * @param int $id
  * @return bool
  */
 public function notify($id)
 {
     $order = $this->orderRepository->get($id);
     return $this->notifier->notify($order);
 }
コード例 #3
0
ファイル: OrderEmail.php プロジェクト: aiesh/magento2
 /**
  * Invoke notifyUser service
  *
  * @param int $id
  * @return bool
  */
 public function invoke($id)
 {
     /** @var \Magento\Sales\Model\Order $order */
     $order = $this->orderRepository->get($id);
     return $this->notifier->notify($order);
 }
コード例 #4
0
 public function testNotify()
 {
     $this->orderRepositoryMock->expects($this->once())->method('get')->with(123)->willReturn($this->orderMock);
     $this->orderNotifierMock->expects($this->once())->method('notify')->with($this->orderMock)->willReturn(true);
     $this->assertTrue($this->orderService->notify(123));
 }