OSDN Git Service

- Dependency on PEAR in Ethna.php, Ethna_Error.php was removed.
[ethna/ethna.git] / test / Ethna_Controller_Test.php
1 <?php
2 // vim: foldmethod=marker
3 /**
4  *  Ethna_Controller_Test.php
5  *
6  *  @author     Yoshinari Takaoka <takaoka@beatcraft.com>
7  *  @version    $Id$
8  */
9
10 //{{{    Ethna_Controller_Test
11 /**
12  *  Test Case For Ethna_Controller_Test 
13  *
14  *  @access public
15  */
16 class Ethna_Controller_Test extends Ethna_UnitTestBase
17 {
18     var $test_ctl;
19
20     function setUp()
21     {
22         $this->test_ctl =& new Ethna_Controller();
23     }
24
25     function tearDown()
26     {
27         unset($GLOBALS['_Ethna_controller']);
28     }
29
30     // {{{ checkAppId
31     function test_checkAppId()
32     {
33         //  予約語(app, ethna)は当然駄目
34         //  これについては大文字、小文字を区別しない
35         $r = $this->test_ctl->checkAppId('ethna');
36         $this->assertTrue(Ethna::isError($r));
37
38         $r = $this->test_ctl->checkAppId('EthNa');
39         $this->assertTrue(Ethna::isError($r));
40
41         $r = $this->test_ctl->checkAppId('ETHNA');
42         $this->assertTrue(Ethna::isError($r));
43
44         $r = $this->test_ctl->checkAppId('app');
45         $this->assertTrue(Ethna::isError($r));
46
47         $r = $this->test_ctl->checkAppId('ApP');
48         $this->assertTrue(Ethna::isError($r));
49
50         $r = $this->test_ctl->checkAppId('APP');
51         $this->assertTrue(Ethna::isError($r));
52
53         //  数字で始まっては駄目
54         $r = $this->test_ctl->checkAppId('1');
55         $this->assertTrue(Ethna::isError($r));
56
57         $r = $this->test_ctl->checkAppId('0abcd');
58         $this->assertTrue(Ethna::isError($r));
59
60         //  始めがアンダースコアも駄目
61         $r = $this->test_ctl->checkAppId('_');
62         $this->assertTrue(Ethna::isError($r));
63
64         $r = $this->test_ctl->checkAppId('_abcd');
65         $this->assertTrue(Ethna::isError($r));
66
67         //  一文字でも英数字以外が混じれば駄目
68         $r = $this->test_ctl->checkAppId('ab;@e');
69         $this->assertTrue(Ethna::isError($r));
70
71         $r = $this->test_ctl->checkAppId('@bcde');
72         $this->assertTrue(Ethna::isError($r));
73
74         $r = $this->test_ctl->checkAppId('abcd:');
75         $this->assertTrue(Ethna::isError($r));
76
77         //  全部英数字であればOK
78         $r = $this->test_ctl->checkAppId('abcd');
79         $this->assertFalse(Ethna::isError($r));
80     }
81     // }}}
82
83     // {{{ test_getClientEncoding
84     function test_getClientEncoding()
85     {
86         $this->assertEqual('UTF-8', $this->test_ctl->getClientEncoding());
87     }
88     // }}} 
89
90     // {{{ test_setClientEncoding
91     function test_setClientEncoding()
92     {
93         $this->test_ctl->setClientEncoding('Shift_JIS');
94         $this->assertEqual('Shift_JIS', $this->test_ctl->getClientEncoding());
95     }
96     // }}}
97
98 }
99 // }}}
100
101 ?>