public function testCustomProgName() { $parser = new Horde_Argv_Parser(array('prog' => 'thingy', 'version' => "%prog 0.1", 'usage' => "%prog arg arg")); $parser->removeOption('-h'); $parser->removeOption('--version'); $expectedUsage = "Usage: thingy arg arg\n"; $this->assertUsage($parser, $expectedUsage); $this->assertVersion($parser, "thingy 0.1"); $this->assertHelp($parser, $expectedUsage . "\n"); }
public function testCallbackHelp() { // This test was prompted by SF bug #960515 -- the point is // not to inspect the help text, just to make sure that // formatHelp() doesn't crash. $parser = new Horde_Argv_Parser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE)); $parser->removeOption('-h'); $parser->addOption('-t', '--test', array('action' => 'callback', 'callback' => array($this, 'returnNull'), 'type' => 'string', 'help' => 'foo')); $expectedHelp = "Options:\n -t TEST, --test=TEST foo\n"; $this->assertHelp($parser, $expectedHelp); }