OSDN Git Service

- create ethna command idea branche
[ethna/ethna.git] / Idea_Plugin_Extlib / class / Plugin / Handle / AddActionTest.php
1 <?php
2 /**
3  *  Ethna_Plugin_Handle_AddActionTest.php
4  *
5  *  @author     halt feits <halt.feits@gmail.com>
6  *  @package    Ethna
7  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
8  *  @version    $Id$
9  */
10
11 require_once ETHNA_BASE . '/class/Plugin/Handle/Ethna_Plugin_Handle_AddAction.php';
12
13 // {{{ Ethna_Plugin_Handle_AddActionTest
14 /**
15  *  add-action-test handler
16  *
17  *  @author     halt feits <halt.feits@gmail.com>
18  *  @access     public
19  *  @package    Ethna
20  */
21 class Ethna_Plugin_Handle_AddActionTest extends Ethna_Plugin_Handle_AddAction
22 {
23     /**
24      *  add action test
25      *
26      *  @access public
27      */
28     function perform()
29     {
30         $r =& $this->_getopt(array('basedir=', 'skelfile='));
31         if (Ethna::isError($r)) {
32             return $r;
33         }
34         list($opt_list, $arg_list) = $r;
35
36         // action_name
37         $action_name = array_shift($arg_list);
38         if ($action_name == null) {
39             return Ethna::raiseError('action name isn\'t set.', 'usage');
40         }
41         $r =& Ethna_Controller::checkActionName($action_name);
42         if (Ethna::isError($r)) {
43             return $r;
44         }
45
46         $ret =& $this->_perform('ActionTest', $action_name, $opt_list);
47         return $ret;
48     }
49
50     /**
51      *  get handler's description
52      *
53      *  @access public
54      */
55     function getDescription()
56     {
57         return <<<EOS
58 add new action test to project:
59     {$this->id} [-b|--basedir=dir] [-s|--skelfile=file] [action]
60
61 EOS;
62     }
63
64     /**
65      *  @access public
66      */
67     function getUsage()
68     {
69         return <<<EOS
70 ethna {$this->id} [-b|--basedir=dir] [-s|--skelfile=file] [action]
71 EOS;
72     }
73 }
74 // }}}
75 ?>