OSDN Git Service

- fixed bug "ethna pear-local list -a" command emits error.
[ethna/ethna.git] / test / Plugin / Handle / Ethna_Plugin_Handle_PearLocal_Test.php
1 <?php
2 // vim: foldmethod=marker
3 /**
4  *  Ethna_Plugin_Handle_PearLocal_Test.php
5  *
6  *  @author     Yoshinari Takaoka <takaoka@beatcraft.com>
7  *  @version    $Id$
8  */
9
10 require_once ETHNA_BASE . '/test/Ethna_MockProject.php';
11
12 //{{{  Ethna_Plugin_Handle_PearLocal_Test
13 /**
14  *  Test Case For Ethna_Plugin_Handle_PearLocal_Test
15  *
16  *  @access public
17  */
18 class Ethna_Plugin_Handle_PearLocal_Test extends Ethna_UnitTestBase 
19 {
20     var $proj;
21
22     function setUp()
23     {
24         $this->proj = new Ethna_MockProject();
25         $r = $this->proj->create();
26         if (Ethna::isError($r)) {
27             $this->fail($r->getMessage());    
28         }
29     }
30
31     function tearDown()
32     {
33         $this->proj->delete();
34     }
35
36     function test_cmd_option()
37     {
38         //    unrecognized option
39         $r = $this->proj->runCmd('pear-local', array('-k'));
40         $this->assertTrue(Ethna::isError($r));
41         $this->assertEqual('unrecognized option -k', $r->getMessage());
42
43         //    pear list -a(get no error)
44         //    @see http://sourceforge.jp/ticket/browse.php?group_id=1343&tid=15760
45         $r = $this->proj->runCmd('pear-local', array('list', '-a'));
46         $this->assertFalse(Ethna::isError($r));
47
48         //    channel requires an argument
49         $r = $this->proj->runCmd('pear-local', array('-c'));
50         $this->assertTrue(Ethna::isError($r));
51         $this->assertEqual('option -c requires an argument', $r->getMessage());
52
53         $r = $this->proj->runCmd('pear-local', array('--channel'));
54         $this->assertTrue(Ethna::isError($r));
55         $this->assertEqual('option --channel requires an argument', $r->getMessage());
56
57         //    normal command exexute
58         $r = $this->proj->runCmd('pear-local', array('install', 'Date'));
59         $this->assertFalse(Ethna::isError($r));
60     }
61 }
62 // }}}
63
64 ?>