source: branches/version-2_13-dev/tests/class/SC_CheckError/SC_CheckError_EXIST_CHECKTest.php @ 22851

Revision 22851, 4.4 KB checked in by kimoto, 11 years ago (diff)

#150 ユニットテスト環境の整備
SC_CheckError EXIST_CHECKを追加

Line 
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__)) . "/../../..";
25require_once($HOME . "/tests/class/Common_TestCase.php");
26
27class SC_CheckError_EXIST_CHECKTest extends Common_TestCase
28{
29
30    protected function setUp()
31    {
32        parent::setUp();
33    }
34
35    protected function tearDown()
36    {
37        parent::tearDown();
38    }
39
40    /////////////////////////////////////////
41
42    public function testEXIST_CHECK_formが空()
43    {
44        $arrForm = array('form' => '');
45        $objErr = new SC_CheckError_Ex($arrForm);
46        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
47
48        $this->expected = '※ EXIST_CHECKが入力されていません。<br />';
49        $this->actual = $objErr->arrErr['form'];
50        $this->verify('');
51    }
52
53    public function testEXIST_CHECK_formがNULL()
54    {
55        $arrForm = array('form' => NULL);
56        $objErr = new SC_CheckError_Ex($arrForm);
57        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
58
59        $this->expected = '※ EXIST_CHECKが入力されていません。<br />';
60        $this->actual = $objErr->arrErr['form'];
61        $this->verify('');
62    }
63
64    public function testEXIST_CHECK_formがint0()
65    {
66        $arrForm = array('form' => 0);
67        $objErr = new SC_CheckError_Ex($arrForm);
68        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
69
70        $this->expected = '';
71        $this->actual = $objErr->arrErr['form'];
72        $this->verify('');
73    }
74
75    public function testEXIST_CHECK_formがstring0()
76    {
77        $arrForm = array('form' => '0');
78        $objErr = new SC_CheckError_Ex($arrForm);
79        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
80
81        $this->expected = '';
82        $this->actual = $objErr->arrErr['form'];
83        $this->verify('');
84    }
85
86    public function testEXIST_CHECK_formが空の配列()
87    {
88        $arrForm = array('form' => array());
89        $objErr = new SC_CheckError_Ex($arrForm);
90        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
91
92        $this->expected = '※ EXIST_CHECKが選択されていません。<br />';
93        $this->actual = $objErr->arrErr['form'];
94        $this->verify('');
95    }
96
97    public function testEXIST_CHECK_formが空文字の配列()
98    {
99        $arrForm = array('form' => array(''));
100        $objErr = new SC_CheckError_Ex($arrForm);
101        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
102
103        $this->expected = '';
104        $this->actual = $objErr->arrErr['form'];
105        $this->verify('');
106    }
107
108    public function testEXIST_CHECK_formが0しか含まない配列()
109    {
110        $arrForm = array('form' => array(0));
111        $objErr = new SC_CheckError_Ex($arrForm);
112        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
113
114        $this->expected = '';
115        $this->actual = $objErr->arrErr['form'];
116        $this->verify('');
117    }
118
119    public function testEXIST_CHECK_formが配列()
120    {
121        $arrForm = array('form' => array(1,2,3));
122        $objErr = new SC_CheckError_Ex($arrForm);
123        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
124
125        $this->expected = '';
126        $this->actual = $objErr->arrErr['form'];
127        $this->verify('');
128    }
129
130    public function testEXIST_CHECK_formが連想配列()
131    {
132        $arrForm = array('form' => array(0=> 'A', 1 => 'B', 2 => 'C'));
133        $objErr = new SC_CheckError_Ex($arrForm);
134        $objErr->doFunc(array('EXIST_CHECK', 'form') ,array('EXIST_CHECK'));
135
136        $this->expected = '';
137        $this->actual = $objErr->arrErr['form'];
138        $this->verify('');
139    }
140}
Note: See TracBrowser for help on using the repository browser.