Beispiel #1
0
 public function loadEnvironment($environmentName)
 {
     $environmentPath = ConfigService::getConfigsPath() . $environmentName . '/' . $this->_name . '.yml';
     $this->_loadedEnvironmentName = $environmentName;
     if (is_file($environmentPath)) {
         $this->_environmentData = new YamlStorage($environmentPath);
         $this->_combinedData->extendDeepValue($this->_environmentData->getData());
     }
     return $this;
 }
Beispiel #2
0
 /**
  * Using for generating profile for database
  * @help Using for generating profile for database
  * @optional [profile name] to specify profile
  */
 public function wizardAction()
 {
     $this->writeln('DB wizard for a profile');
     $profileName = $this->ask('Enter the <underline>profile name</underline> to edit', 'default');
     $fields = $this->askArray(array('name' => array('DB name'), 'user' => array('DB user', 'root'), 'pass' => array('DB password', 'root'), 'host' => array('DB host', '127.0.0.1')));
     if ($this->confirm('Write to file', true)) {
         $config = DC::getDatabaseConfig();
         foreach ($fields as $field => $value) {
             $config->set('profiles/' . $profileName . '/' . $field, $value);
         }
         $config->save();
         $this->notify(ConfigService::getConfigsPath() . 'database.yml', 'saved');
     } else {
         $this->writeln('exiting.');
     }
 }
Beispiel #3
0
 public function testBasic()
 {
     ConfigService::setConfigsPath(self::$_configPath);
     $this->assertEquals(self::$_configPath, ConfigService::getConfigsPath(), 'Config path set correctly');
     $projectConfig = ConfigService::getConfig('project');
     $this->assertInstanceOf('\\Solve\\Config\\Config', $projectConfig, 'Service returned new instance of Config');
     $this->assertEquals('project', $projectConfig->getName(), 'Loaded correct config by name');
     $this->assertEquals('test', $projectConfig->get('project_name'), 'Data from project.yml');
     $this->assertEquals(false, $projectConfig->get('dev_mode'), 'General value loaded');
     ConfigService::loadEnvironment('local');
     $this->assertEquals(true, $projectConfig->get('dev_mode'), 'Local value loaded');
     ConfigService::loadEnvironment('youshido.com');
     $this->assertEquals(false, $projectConfig->get('dev_mode'), 'Overriden value loaded');
     ConfigService::loadEnvironment('local');
     $projectConfig->set('project_name', 'config test');
     $this->assertEquals('config test', $projectConfig->get('project_name'), 'update key in memory');
     $projectConfig->save();
 }