1: <?php
2: /**
3: * A test helper for testing Horde_Argv based classes.
4: *
5: * PHP version 5
6: *
7: * @category Horde
8: * @package Test
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL
11: * @link http://www.horde.org/components/Horde_Test
12: */
13:
14: /**
15: * A test helper for testing Horde_Argv based classes.
16: *
17: * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you
20: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21: *
22: * @since Horde_Test 1.2.0
23: *
24: * @category Horde
25: * @package Test
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL
28: * @link http://www.horde.org/components/Horde_Test
29: */
30: class Horde_Test_Stub_Parser
31: extends Horde_Argv_Parser
32: {
33: /**
34: * Print a usage message incorporating $msg to stderr and exit.
35: * If you override this in a subclass, it should not return -- it
36: * should either exit or raise an exception.
37: *
38: * @param string $msg
39: */
40: public function parserError($msg)
41: {
42: $this->printUsage();
43: $this->parserExit(2, sprintf("%s: error: %s\n", $this->getProgName(), $msg));
44: }
45:
46: public function parserExit($status = 0, $msg = null)
47: {
48: if ($msg) {
49: echo $msg;
50: }
51: }
52: }