示例#1
0
 public function testInvoke()
 {
     $creditmemoId = 1;
     $creditmemo = $this->getMock('\\Magento\\Sales\\Model\\Order\\Creditmemo', ['__wakeup', 'getEmailSent'], [], '', false);
     $this->creditmemoRepository->expects($this->once())->method('get')->with($creditmemoId)->will($this->returnValue($creditmemo));
     $this->notifier->expects($this->any())->method('notify')->with($creditmemo)->will($this->returnValue(true));
     $this->assertTrue($this->service->invoke($creditmemoId));
 }
 /**
  * Run test notify method
  */
 public function testNotify()
 {
     $id = 123;
     $returnValue = 'return-value';
     $modelMock = $this->getMockForAbstractClass('Magento\\Sales\\Model\\AbstractModel', [], '', false);
     $this->creditmemoRepositoryMock->expects($this->once())->method('get')->with($id)->will($this->returnValue($modelMock));
     $this->creditmemoNotifierMock->expects($this->once())->method('notify')->with($modelMock)->will($this->returnValue($returnValue));
     $this->assertEquals($returnValue, $this->creditmemoService->notify($id));
 }