private function createQueueEnabledSetting() { $self = $this; $this->queueEnabled = new SystemSetting('queueEnabled', 'Queue enabled'); $this->queueEnabled->readableByCurrentUser = true; $this->queueEnabled->type = static::TYPE_BOOL; $this->queueEnabled->uiControlType = static::CONTROL_CHECKBOX; $this->queueEnabled->inlineHelp = 'If enabled, all tracking requests will be written into a queue instead of the directly into the database. Requires a Redis server and phpredis PHP extension.'; $this->queueEnabled->defaultValue = false; $this->queueEnabled->validate = function ($value) use($self) { $value = (bool) $value; if ($value) { $host = $self->redisHost->getValue(); $port = $self->redisPort->getValue(); $timeout = $self->redisTimeout->getValue(); $password = $self->redisPassword->getValue(); $systemCheck = new SystemCheck(); $systemCheck->checkRedisIsInstalled(); $systemCheck->checkConnectionDetails($host, $port, $timeout, $password); } }; $this->addSetting($this->queueEnabled); }
public function test_checkConnectionDetails_shouldNotFailIfConnectionDataIsCorrect() { $this->systemCheck->checkConnectionDetails('127.0.0.1', 6379, 0.2, null); $this->assertTrue(true); }