Example #1
0
File: setup.php Project: visor/nano
 /**
  * @return int
  * @param array|\string[] $args
  */
 public function run(array $args)
 {
     if (0 == count($args)) {
         $this->stop('Please pass configuration name to setup');
         return 1;
     }
     $builder = new \Nano\Application\Config\Builder($this->getApplication());
     $builder->setSource($this->getApplication()->rootDir . DIRECTORY_SEPARATOR . 'settings');
     $builder->setDestination($this->getApplication()->rootDir . DIRECTORY_SEPARATOR . 'settings');
     $builder->clean();
     $builder->build($args[0]);
     return 0;
 }
Example #2
0
 protected function setUp()
 {
     parent::setUp();
     $this->application->withConfigurationFormat('php')->withRootDir($GLOBALS['application']->rootDir);
     rename($this->application->rootDir . DIRECTORY_SEPARATOR . 'settings' . DIRECTORY_SEPARATOR . \Nano\Application\Config::CONFIG_FILE_NAME, $this->application->rootDir . DIRECTORY_SEPARATOR . 'settings' . DIRECTORY_SEPARATOR . \Nano\Application\Config::CONFIG_FILE_NAME . '.bak');
     rename($this->application->rootDir . DIRECTORY_SEPARATOR . 'settings' . DIRECTORY_SEPARATOR . \Nano\Application\Config::ROUTES_FILE_NAME, $this->application->rootDir . DIRECTORY_SEPARATOR . 'settings' . DIRECTORY_SEPARATOR . \Nano\Application\Config::ROUTES_FILE_NAME . '.bak');
     $builder = new \Nano\Application\Config\Builder($this->application);
     $builder->setSource($this->application->rootDir . DIRECTORY_SEPARATOR . 'settings');
     $builder->setDestination($this->application->rootDir . DIRECTORY_SEPARATOR . 'settings');
     $builder->build('for-test');
     $this->application->configure();
     $this->response = new \Nano\Controller\Response\Test($this->application);
     $this->application->dispatcher->setResponse($this->response);
 }