Ejemplo n.º 1
0
 public function testShortOptionWithParameter()
 {
     $op = new OptionParser();
     $op->addRule('a|b:');
     $op->addRule('c::');
     $this->assertTrue($op->isOptional('a'));
     $this->assertTrue($op->isOptional('b'));
     $this->assertTrue($op->isRequired('c'));
     $args = array("-", "-a", "1", "-c", "string");
     $op->parse($args);
     $this->assertEquals($op->a, 1);
     $this->assertEquals($op->b, 1);
     $this->assertEquals($op->c, 'string');
     $this->setExpectedException('Exception');
     $args = array('-', '-c');
     $op->parse($args);
 }