/** * Invoke shipment remove track * * @param int $id * @return bool * @throws \Exception */ public function invoke($id) { /** @var \Magento\Sales\Model\Order\Shipment\Track $trackModel */ $trackModel = $this->trackRepository->get($id); $trackModel->delete(); return true; }
/** * Test shipment remove track */ public function testInvoke() { $this->trackRepositoryMock->expects($this->once())->method('get')->with($this->equalTo(1))->will($this->returnValue($this->trackMock)); $this->trackMock->expects($this->once())->method('delete'); $this->assertTrue($this->shipmentRemoveTrack->invoke(1)); }