1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
6 | * |
---|
7 | * http://www.lockon.co.jp/ |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License |
---|
11 | * as published by the Free Software Foundation; either version 2 |
---|
12 | * of the License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this program; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
22 | */ |
---|
23 | |
---|
24 | $HOME = realpath(dirname(__FILE__)) . "/../../.."; |
---|
25 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
---|
26 | |
---|
27 | class SC_CheckError_EXIST_CHECKTest extends Common_TestCase |
---|
28 | { |
---|
29 | |
---|
30 | protected function setUp() |
---|
31 | { |
---|
32 | parent::setUp(); |
---|
33 | $this->target_func = 'EXIST_CHECK'; |
---|
34 | } |
---|
35 | |
---|
36 | protected function tearDown() |
---|
37 | { |
---|
38 | parent::tearDown(); |
---|
39 | } |
---|
40 | |
---|
41 | ///////////////////////////////////////// |
---|
42 | |
---|
43 | public function testEXIST_CHECK_formが空文字の場合_エラー() |
---|
44 | { |
---|
45 | $disp_name = $this->target_func; |
---|
46 | $arrForm = array('form' => ''); |
---|
47 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
48 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
49 | |
---|
50 | $this->expected = "※ {$disp_name}が入力されていません。<br />"; |
---|
51 | $this->actual = $objErr->arrErr['form']; |
---|
52 | $this->verify(''); |
---|
53 | } |
---|
54 | |
---|
55 | public function testEXIST_CHECK_formがnullの場合_エラー() |
---|
56 | { |
---|
57 | $disp_name = $this->target_func; |
---|
58 | $arrForm = array('form' => null); |
---|
59 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
60 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
61 | |
---|
62 | $this->expected = "※ {$disp_name}が入力されていません。<br />"; |
---|
63 | $this->actual = $objErr->arrErr['form']; |
---|
64 | $this->verify(''); |
---|
65 | } |
---|
66 | |
---|
67 | public function testEXIST_CHECK_formがfalseの場合_エラー() |
---|
68 | { |
---|
69 | $disp_name = $this->target_func; |
---|
70 | $arrForm = array('form' => false); |
---|
71 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
72 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
73 | |
---|
74 | $this->expected = "※ {$disp_name}が入力されていません。<br />"; |
---|
75 | $this->actual = $objErr->arrErr['form']; |
---|
76 | $this->verify(''); |
---|
77 | } |
---|
78 | |
---|
79 | public function testEXIST_CHECK_formがint0の場合_エラーではない() |
---|
80 | { |
---|
81 | $disp_name = $this->target_func; |
---|
82 | $arrForm = array('form' => 0); |
---|
83 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
84 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
85 | |
---|
86 | $this->expected = ''; |
---|
87 | $this->actual = $objErr->arrErr['form']; |
---|
88 | $this->verify(''); |
---|
89 | } |
---|
90 | |
---|
91 | public function testEXIST_CHECK_formがfloat0の場合_エラーではない() |
---|
92 | { |
---|
93 | $disp_name = $this->target_func; |
---|
94 | $arrForm = array('form' => 0.0); |
---|
95 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
96 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
97 | |
---|
98 | $this->expected = ''; |
---|
99 | $this->actual = $objErr->arrErr['form']; |
---|
100 | $this->verify(''); |
---|
101 | } |
---|
102 | |
---|
103 | public function testEXIST_CHECK_formがstring0の場合_エラーではない() |
---|
104 | { |
---|
105 | $disp_name = $this->target_func; |
---|
106 | $arrForm = array('form' => '0'); |
---|
107 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
108 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
109 | |
---|
110 | $this->expected = ''; |
---|
111 | $this->actual = $objErr->arrErr['form']; |
---|
112 | $this->verify(''); |
---|
113 | } |
---|
114 | |
---|
115 | public function testEXIST_CHECK_formが普通の文字列の場合_エラーではない() |
---|
116 | { |
---|
117 | $disp_name = $this->target_func; |
---|
118 | $arrForm = array('form' => '普通のテスト文字列'); |
---|
119 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
120 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
121 | |
---|
122 | $this->expected = ''; |
---|
123 | $this->actual = $objErr->arrErr['form']; |
---|
124 | $this->verify(''); |
---|
125 | } |
---|
126 | |
---|
127 | public function testEXIST_CHECK_formが空の配列の場合_エラー() |
---|
128 | { |
---|
129 | $disp_name = $this->target_func; |
---|
130 | $arrForm = array('form' => array()); |
---|
131 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
132 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
133 | |
---|
134 | $this->expected = "※ {$disp_name}が選択されていません。<br />"; |
---|
135 | $this->actual = $objErr->arrErr['form']; |
---|
136 | $this->verify(''); |
---|
137 | } |
---|
138 | |
---|
139 | public function testEXIST_CHECK_formが空文字の配列の場合_エラーではない() |
---|
140 | { |
---|
141 | $disp_name = $this->target_func; |
---|
142 | $arrForm = array('form' => array('')); |
---|
143 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
144 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
145 | |
---|
146 | $this->expected = ''; |
---|
147 | $this->actual = $objErr->arrErr['form']; |
---|
148 | $this->verify(''); |
---|
149 | } |
---|
150 | |
---|
151 | public function testEXIST_CHECK_formが0しか含まない配列の場合_エラーではない() |
---|
152 | { |
---|
153 | $disp_name = $this->target_func; |
---|
154 | $arrForm = array('form' => array(0)); |
---|
155 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
156 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
157 | |
---|
158 | $this->expected = ''; |
---|
159 | $this->actual = $objErr->arrErr['form']; |
---|
160 | $this->verify(''); |
---|
161 | } |
---|
162 | |
---|
163 | public function testEXIST_CHECK_formが配列の場合_エラーではない() |
---|
164 | { |
---|
165 | $disp_name = $this->target_func; |
---|
166 | $arrForm = array('form' => array(1, 2, 3)); |
---|
167 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
168 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
169 | |
---|
170 | $this->expected = ''; |
---|
171 | $this->actual = $objErr->arrErr['form']; |
---|
172 | $this->verify(''); |
---|
173 | } |
---|
174 | |
---|
175 | public function testEXIST_CHECK_formが連想配列の場合_エラーではない() |
---|
176 | { |
---|
177 | $disp_name = $this->target_func; |
---|
178 | $arrForm = array('form' => array(0=> 'A', 1 => 'B', 2 => 'C')); |
---|
179 | $objErr = new SC_CheckError_Ex($arrForm); |
---|
180 | $objErr->doFunc(array($disp_name, 'form'), array($this->target_func)); |
---|
181 | |
---|
182 | $this->expected = ''; |
---|
183 | $this->actual = $objErr->arrErr['form']; |
---|
184 | $this->verify(''); |
---|
185 | } |
---|
186 | } |
---|