Exemplo n.º 1
0
 public function testCanCreateOptionalArg()
 {
     $name = '<command>';
     $desc = 'The <command> you need help with';
     $obj = new DefinedArg($name, $desc);
     $obj->setIsOptional();
     // did it work?
     $this->assertEquals($name, $obj->name);
     $this->assertEquals($desc, $obj->desc);
     $this->assertTrue($obj->testIsOptional());
     $this->assertFalse($obj->testIsRequired());
 }
Exemplo n.º 2
0
 /**
  * Add an optional argument that this switch accepts
  *
  * @param string $argName the name of the argument
  * @param string $argDesc the argument's description
  * @return DefinedSwitch
  */
 public function setWithOptionalArg($argName, $argDesc)
 {
     $this->arg = new DefinedArg($argName, $argDesc);
     $this->arg->setIsOptional();
     return $this;
 }