public function testParseInvalidArgument() { $this->setExpectedException('UnexpectedValueException'); $validation = 'is_numeric'; $option = new Option('a', null, Getopt::OPTIONAL_ARGUMENT); $option->setArgument(new Argument(null, $validation)); $parser = new CommandLineParser(array($option)); $parser->parse('-a nonnumeric'); }
public function testOffsetUnset() { $this->setExpectedException('LogicException'); $option = new Option('a', 'arg', Getopt::REQUIRED_ARGUMENT); $option->setDefaultValue('plus'); $getopt = new Getopt(array($option)); $getopt->parse(''); unset($getopt['a']); }
public function testSetArgumentWrongMode() { $this->setExpectedException('InvalidArgumentException'); $option = new Option('a', null, Getopt::NO_ARGUMENT); $option->setArgument(new Argument()); }