示例#1
0
 public function testSettersAndGetters()
 {
     $inputArgs = new InputArgs();
     $inputArgs->setArguments(['arg1', 'arg2']);
     $this->assertEquals(['arg1', 'arg2'], $inputArgs->getArguments());
     $inputArgs->setOptions(['opt1' => 'val1', 'opt2' => 'val2']);
     $this->assertEquals(['opt1' => 'val1', 'opt2' => 'val2'], $inputArgs->getOptions());
     $this->assertEquals('val2', $inputArgs->getOption('opt2'));
     $this->assertEquals(NULL, $inputArgs->getOption('nonExistingOpt'));
 }
示例#2
0
 private function selfInit(InputArgs $inputArgs)
 {
     $arguments = $inputArgs->getArguments();
     if (isset($arguments[0]) && $arguments[0] === 'self-init') {
         $directoryName = isset($arguments[1]) ? $arguments[1] : 'build';
         $selfInit = new Commands\SelfInit();
         $selfInit->setDistDirectory(__DIR__ . '/build-dist');
         $selfInit->setWorkingDirectory($this->workingDir);
         $selfInit->setDirname($directoryName);
         $selfInit->execute();
         $this->terminate(0);
     }
 }
示例#3
0
 private function createInputArgs(array $args = [], array $options = [])
 {
     $inputArgs = new InputArgs();
     $inputArgs->setArguments($args);
     $inputArgs->setOptions($options + ['colors' => 0]);
     return $inputArgs;
 }