Add test for options with 0 value.

This commit is contained in:
mark_story 2012-12-10 22:10:00 -05:00
parent 693ca5481e
commit b20f6e132d

View file

@ -78,6 +78,18 @@ class ConsoleOptionParserTest extends CakeTestCase {
$this->assertEquals(array('test' => 'value', 'help' => false), $result[0], 'Long parameter did not parse out');
}
/**
* test adding an option with a zero value
*
* @return void
*/
public function testAddOptionZero() {
$parser = new ConsoleOptionParser('test', false);
$parser->addOption('count', array());
$result = $parser->parse(array('--count', '0'));
$this->assertEquals(array('count' => '0', 'help' => false), $result[0], 'Zero parameter did not parse out');
}
/**
* test addOption with an object.
*