public function testCanVoidWithExistingOrderWithInvoice() { $orderMock = $this->getMockBuilder('\\Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->setMethods(['getId', 'hasInvoices'])->getMock(); $orderMock->expects($this->once())->method('getId')->willReturn(1); $orderMock->expects($this->once())->method('hasInvoices')->willReturn(true); $this->registryMock->expects($this->once())->method('registry')->with('current_order')->willReturn($orderMock); $this->assertEquals(false, $this->model->canVoid()); }