Esempio n. 1
0
 /**
  * @covers Opl_Getopt_Option::setMinOccurences
  * @covers Opl_Getopt_Option::getMinOccurences
  */
 public function testCountingOccurencesByFoundStatus()
 {
     $option = new Opl_Getopt_Option('foo', 'x');
     $this->assertEquals(0, $option->getOccurences());
     $option->setFound(true);
     $this->assertEquals(1, $option->getOccurences());
     $option->setFound(true);
     $this->assertEquals(2, $option->getOccurences());
     $option->setFound(true);
     $this->assertEquals(3, $option->getOccurences());
     $option->setFound(false);
     $this->assertEquals(0, $option->getOccurences());
 }
Esempio n. 2
0
 /**
  * @covers Opl_Getopt::__construct
  * @covers Opl_Getopt::parse
  */
 public function testShortAttributeUsedTwiceWithIncrementation2()
 {
     $getopt = new Opl_Getopt(Opl_Getopt::ALLOW_INCREMENTING);
     $getopt->addOption($option = new Opl_Getopt_Option('a', 'a'));
     $option->setMaxOccurences(2);
     $this->assertTrue($getopt->parse(array('-aa')));
     $this->assertEquals(2, $option->getOccurences());
 }