orderGrid = $this->getMockBuilder(GridInterface::class) ->getMockForAbstractClass(); $this->globalConfig = $this->getMockBuilder(ScopeConfigInterface::class) ->getMockForAbstractClass(); $this->model = new OrderGridUpdater($this->orderGrid, $this->globalConfig); } public function testUpdateInSyncMode() { $orderId = 1; $this->globalConfig->expects($this->once()) ->method('getValue') ->with('dev/grid/async_indexing', 'default', null) ->willReturn(false); $this->orderGrid->expects($this->once()) ->method('refresh') ->with($orderId); $this->model->update($orderId); } public function testUpdateInAsyncMode() { $orderId = 1; $this->globalConfig->expects($this->once()) ->method('getValue') ->with('dev/grid/async_indexing', 'default', null) ->willReturn(true); $this->orderGrid->expects($this->never()) ->method('refresh') ->with($orderId); $this->model->update($orderId); } }