mathRandomMock = $this->getMockBuilder(Random::class) ->disableOriginalConstructor() ->setMethods([]) ->getMock(); $this->configMock = $this->getMockBuilder(ConfigInterface::class) ->disableOriginalConstructor() ->setMethods([]) ->getMockForAbstractClass(); $objectManager = new ObjectManager($this); $this->model = $objectManager->getObject( Data::class, [ 'config' => $this->configMock, 'mathRandom' => $this->mathRandomMock ] ); } public function testGenerateResetPasswordLinkToken() { $hash = 'hashString'; $this->mathRandomMock->expects($this->once())->method('getUniqueHash')->willReturn($hash); $this->assertEquals($hash, $this->model->generateResetPasswordLinkToken()); } public function testGetResetPasswordLinkExpirationPeriod() { $value = '123'; $this->configMock->expects($this->once()) ->method('getValue') ->with(Data::XML_PATH_ADMIN_RESET_PASSWORD_LINK_EXPIRATION_PERIOD) ->willReturn($value); $this->assertEquals((int) $value, $this->model->getResetPasswordLinkExpirationPeriod()); } }