/** * Prepares static part of svn command to be used across the script. * * @return void */ protected function prepareSvnCommand() { $username = $this->_configEditor->get('repository-connector.username'); $password = $this->_configEditor->get('repository-connector.password'); $this->_svnCommand .= ' --non-interactive'; if ($username) { $this->_svnCommand .= ' --username ' . $username; } if ($password) { $this->_svnCommand .= ' --password ' . $password; } }
/** * Returns update channel. * * @return string */ protected function getUpdateChannel() { if ($this->io->getOption('stable')) { $this->_configEditor->set('update-channel', Stability::STABLE); } if ($this->io->getOption('snapshot')) { $this->_configEditor->set('update-channel', Stability::SNAPSHOT); } if ($this->io->getOption('preview')) { $this->_configEditor->set('update-channel', Stability::PREVIEW); } return $this->_configEditor->get('update-channel'); }
public function testConfigStoredDefaultsAreUpgraded() { $stored_values = array('setting_a' => 'saved_a', 'setting_b' => 'saved_b'); file_put_contents($this->configPath, json_encode($stored_values)); $config_editor = new ConfigEditor($this->configPath, array('setting_a' => 'default_a', 'setting_b' => 'default_b', 'setting_c' => 'default_c')); // Confirm, that upgraded settings are immediately available. $this->assertEquals('saved_a', $config_editor->get('setting_a'), 'The "setting_a" was preserved.'); $this->assertEquals('saved_b', $config_editor->get('setting_b'), 'The "setting_b" was preserved.'); $this->assertEquals('default_c', $config_editor->get('setting_c'), 'The "setting_c" was added with default.'); // Confirm, that upgrades settings were saved to disk. $config_editor = new ConfigEditor($this->configPath); $this->assertEquals('saved_a', $config_editor->get('setting_a'), 'The "setting_a" was preserved after save.'); $this->assertEquals('saved_b', $config_editor->get('setting_b'), 'The "setting_b" was preserved after save.'); $this->assertEquals('default_c', $config_editor->get('setting_c'), 'The "setting_c" was added with default after save.'); }
/** * Determines if value matches inherited one. * * @param string $caller_method Caller method. * @param integer $scope_bit Scope bit. * * @return mixed */ private function _getInheritedValue($caller_method, $scope_bit) { if ($scope_bit === self::SCOPE_WORKING_COPY) { return $this->_editor->get($this->_getScopedName($caller_method, self::SCOPE_GLOBAL), $this->_defaultValue); } return $this->_defaultValue; }
/** * @dataProvider storageDataProvider */ public function testStorage($user_value, $stored_value) { $config_setting = $this->createConfigSetting(AbstractConfigSetting::SCOPE_GLOBAL); $config_setting->setValue($user_value); $this->assertSame($stored_value, $this->configEditor->get('global-settings.name')); }
/** * Returns command setting value. * * @param string $name Name. * * @return mixed */ protected function getSetting($name) { return $this->_configEditor->get($name); }