1 | <?php |
---|
2 | |
---|
3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
4 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
---|
5 | /* |
---|
6 | * This file is part of EC-CUBE |
---|
7 | * |
---|
8 | * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved. |
---|
9 | * |
---|
10 | * http://www.lockon.co.jp/ |
---|
11 | * |
---|
12 | * This program is free software; you can redistribute it and/or |
---|
13 | * modify it under the terms of the GNU General Public License |
---|
14 | * as published by the Free Software Foundation; either version 2 |
---|
15 | * of the License, or (at your option) any later version. |
---|
16 | * |
---|
17 | * This program is distributed in the hope that it will be useful, |
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
20 | * GNU General Public License for more details. |
---|
21 | * |
---|
22 | * You should have received a copy of the GNU General Public License |
---|
23 | * along with this program; if not, write to the Free Software |
---|
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
25 | */ |
---|
26 | |
---|
27 | /** |
---|
28 | * SC_Utils::sfGetClassCatCount()のテストクラス. |
---|
29 | * |
---|
30 | * |
---|
31 | * @author Hiroko Tamagawa |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class SC_Utils_sfGetClassCatCountTest extends Common_TestCase { |
---|
35 | |
---|
36 | |
---|
37 | protected function setUp() { |
---|
38 | parent::setUp(); |
---|
39 | $this->setUpClassCat(); |
---|
40 | } |
---|
41 | |
---|
42 | protected function tearDown() { |
---|
43 | parent::tearDown(); |
---|
44 | } |
---|
45 | |
---|
46 | ///////////////////////////////////////// |
---|
47 | public function testSfGetClassCatCount__規格分類の件数がIDごとに取得できる() { |
---|
48 | |
---|
49 | $this->expected = array( |
---|
50 | '1001' => '2', |
---|
51 | '1002' => '1' |
---|
52 | ); |
---|
53 | $this->actual = SC_Utils::sfGetClassCatCount(); |
---|
54 | |
---|
55 | $this->verify('規格分類の件数'); |
---|
56 | } |
---|
57 | |
---|
58 | ////////////////////////////////////////// |
---|
59 | |
---|
60 | protected function setUpClassCat() { |
---|
61 | $classes = array( |
---|
62 | array( |
---|
63 | 'class_id' => '1001', |
---|
64 | 'name' => '味', |
---|
65 | 'creator_id' => '1', |
---|
66 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
67 | 'del_flg' => '0' |
---|
68 | ), |
---|
69 | array( |
---|
70 | 'class_id' => '1002', |
---|
71 | 'name' => '大きさ', |
---|
72 | 'creator_id' => '1', |
---|
73 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
74 | 'del_flg' => '0' |
---|
75 | ), |
---|
76 | // 削除フラグが立っているので検索されない |
---|
77 | array( |
---|
78 | 'class_id' => '1003', |
---|
79 | 'name' => '匂い', |
---|
80 | 'creator_id' => '1', |
---|
81 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
82 | 'del_flg' => '1' |
---|
83 | ) |
---|
84 | ); |
---|
85 | $this->objQuery->delete('dtb_class'); |
---|
86 | foreach ($classes as $item) { |
---|
87 | $this->objQuery->insert('dtb_class', $item); |
---|
88 | } |
---|
89 | |
---|
90 | $class_categories = array( |
---|
91 | array( |
---|
92 | 'classcategory_id' => '1011', |
---|
93 | 'class_id' => '1001', |
---|
94 | 'creator_id' => '1', |
---|
95 | 'update_date' => 'CURRENT_TIMESTAMP' |
---|
96 | ), |
---|
97 | // 削除フラグが立っているので検索されない |
---|
98 | array( |
---|
99 | 'classcategory_id' => '1012', |
---|
100 | 'class_id' => '1001', |
---|
101 | 'creator_id' => '1', |
---|
102 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
103 | 'del_flg' => '1' |
---|
104 | ), |
---|
105 | array( |
---|
106 | 'classcategory_id' => '1013', |
---|
107 | 'class_id' => '1001', |
---|
108 | 'creator_id' => '1', |
---|
109 | 'update_date' => 'CURRENT_TIMESTAMP' |
---|
110 | ), |
---|
111 | array( |
---|
112 | 'classcategory_id' => '1021', |
---|
113 | 'class_id' => '1002', |
---|
114 | 'creator_id' => '1', |
---|
115 | 'update_date' => 'CURRENT_TIMESTAMP' |
---|
116 | ), |
---|
117 | // dtb_classでdel_flgが立っているので検索されない |
---|
118 | array( |
---|
119 | 'classcategory_id' => '1031', |
---|
120 | 'class_id' => '1003', |
---|
121 | 'creator_id' => '1', |
---|
122 | 'update_date' => 'CURRENT_TIMESTAMP' |
---|
123 | ) |
---|
124 | ); |
---|
125 | $this->objQuery->delete('dtb_classcategory'); |
---|
126 | foreach ($class_categories as $item) { |
---|
127 | $this->objQuery->insert('dtb_classcategory', $item); |
---|
128 | } |
---|
129 | } |
---|
130 | } |
---|
131 | |
---|