/** * @covers Opl_Getopt_Option::setMinOccurences * @covers Opl_Getopt_Option::getMinOccurences */ public function testMinOccurencesSetting() { $option = new Opl_Getopt_Option('foo', 'x'); $option->setMinOccurences(5); $this->assertEquals(5, $option->getMinOccurences()); }
/** * @covers Opl_Getopt::__construct * @covers Opl_Getopt::parse * @expectedException Opl_Getopt_Exception */ public function testLongAttributeUsedFewerThanPossible() { $getopt = new Opl_Getopt(Opl_Getopt::ALLOW_INCREMENTING); $getopt->addOption($option = new Opl_Getopt_Option('bar', null, 'bar')); $option->setMinOccurences(2); $option->setMaxOccurences(5); $getopt->parse(array('--bar')); }