/** * Run test setCapture method */ public function testSetCapture() { $id = 145; $returnValue = true; $invoiceMock = $this->getMock('Magento\\Sales\\Model\\Order\\Invoice', ['capture'], [], '', false); $this->repositoryMock->expects($this->once())->method('get')->with($id)->will($this->returnValue($invoiceMock)); $invoiceMock->expects($this->once())->method('capture')->will($this->returnValue($returnValue)); $this->assertTrue($this->invoiceService->setCapture($id)); }