コード例 #1
0
 /**
  * @depends testGetProcessConfig
  */
 public function testSaveConfig()
 {
     $configData = "command=task-runner";
     $this->configHandler->createConfig('test-process', $configData);
     $this->assertFileExists($this->configDirPath . DIRECTORY_SEPARATOR . 'test-process.conf');
     $this->configHandler->getProcessConfig();
     $this->configHandler->saveConfig('user=test');
     $this->assertEquals('user=test', $this->configHandler->getProcessConfig());
 }
コード例 #2
0
 /**
  * Sets the property values obtained from a configuration file.
  *
  * @throws ProcessConfigException
  * @throws \Exception
  */
 public function prepareProcessConfig()
 {
     $processConfigData = $this->_config->getProcessConfig($this->_programName);
     if (!$processConfigData) {
         $this->_state = 'create';
         return;
     }
     $configInArray = preg_split('/\\n/', $processConfigData);
     foreach ($configInArray as $configParam) {
         list($optionName, $optionValue) = explode('=', $configParam);
         $optionName = trim($optionName);
         $optionValue = trim($optionValue);
         if ($this->hasProperty($optionName)) {
             $this->{$optionName} = $optionValue;
         }
     }
 }