eavConfig = $this->createPartialMock(\Magento\Eav\Model\Config::class, ['getEntityType']); $this->model = $objectManager->getObject( \Magento\Sales\Model\Increment::class, ['eavConfig' => $this->eavConfig] ); $this->type = $this->createPartialMock(\Magento\Eav\Model\Entity\Type::class, ['fetchNewIncrementId']); } public function testGetCurrentValue() { $this->type->expects($this->once()) ->method('fetchNewIncrementId') ->with(1) ->willReturn(2); $this->eavConfig->expects($this->once()) ->method('getEntityType') ->with('order') ->willReturn($this->type); $this->model->getNextValue(1); $this->assertEquals(2, $this->model->getCurrentValue()); } public function testNextValue() { $this->type->expects($this->once()) ->method('fetchNewIncrementId') ->with(1) ->willReturn(2); $this->eavConfig->expects($this->once()) ->method('getEntityType') ->with('order') ->willReturn($this->type); $this->assertEquals(2, $this->model->getNextValue(1)); } }