public function testInvoke() { $invoiceId = 1; $invoice = $this->getMock('\\Magento\\Sales\\Model\\Order\\Invoice', ['__wakeup', 'getEmailSent'], [], '', false); $this->invoiceRepository->expects($this->once())->method('get')->with($invoiceId)->will($this->returnValue($invoice)); $this->notifier->expects($this->any())->method('notify')->with($invoice)->will($this->returnValue(true)); $this->assertTrue($this->service->invoke($invoiceId)); }
/** * Run test notify method */ public function testNotify() { $id = 123; $returnValue = 'return-value'; $modelMock = $this->getMockForAbstractClass('Magento\\Sales\\Model\\AbstractModel', [], '', false); $this->repositoryMock->expects($this->once())->method('get')->with($id)->will($this->returnValue($modelMock)); $this->invoiceNotifierMock->expects($this->once())->method('notify')->with($modelMock)->will($this->returnValue($returnValue)); $this->assertEquals($returnValue, $this->invoiceService->notify($id)); }