Exemplo n.º 1
0
 public function testGetOptionObjects()
 {
     $opts[] = new Option('a', null);
     $opts[] = new Option('l', 'long');
     $getopt = new Getopt($opts);
     $opt2 = $getopt->getOptionObjects();
     $this->assertSame($opt2['a'], $opts[0]);
     $this->assertSame($opt2['l'], $opts[1]);
     $this->assertSame($opt2['long'], $opts[1]);
 }
Exemplo n.º 2
0
 public function setupGetopt()
 {
     $getopt = new Getopt();
     $getopt->addOptions($this->getCommandlineOptions());
     $getopt->addOptions($this->xinc->getCommandlineOptions());
     $loader = $this->xinc->getConfigLoader();
     $getopt->addOptions($loader->getCommandlineOptions());
     // add more defaults
     $options = $getopt->getOptionObjects();
     $base = $options['working-dir']->getDefaultValue();
     $options['config-dir']->setDefaultValue("{$base}etc/xinc/");
     $options['project-dir']->setDefaultValue($options['config-dir']->getDefaultValue() . Xinc::DEFAULT_PROJECT_DIR . "/");
     return $getopt;
 }