示例#1
0
 public function testSet()
 {
     Config::set('stack', 'wordpress');
     $this->assertEquals('wordpress', Config::get('stack'));
     Config::reset();
     $this->assertArrayNotHasKey('stack', Config::get());
     Config::set('stack', 'wordpress');
     Config::write();
     Config::reset();
     $this->assertEquals('wordpress', Config::get('stack'));
 }
示例#2
0
 /**
  * @inheritdoc
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     if (empty(Config::get())) {
         $this->cwd = getcwd();
         /** @var QuestionHelper $helper */
         $helper = $this->getHelper('question');
         $output->writeln("<comment>Current directory: {$this->cwd}");
         $question = new ConfirmationQuestion("<info>There isn't a project here, create one? [Y,n] </info>");
         if ($helper->ask($input, $output, $question)) {
             Config::set('alias-group', basename($this->cwd));
             Config::set('name', basename($this->cwd));
             Config::set('path', $this->cwd);
             if (!Config::write($this->cwd)) {
                 throw new \Exception('There was an error writing the platform configuration.');
             }
         } else {
             exit(1);
         }
     }
     parent::initialize($input, $output);
 }