source: branches/version-2_12-dev/tests/class/SC_Product/SC_Product_TestBase.php @ 22796

Revision 22796, 6.1 KB checked in by h_yoshimoto, 11 years ago (diff)

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../..";
4require_once($HOME . "/tests/class/Common_TestCase.php");
5/**
6 *
7 */
8class SC_Product_TestBase extends Common_TestCase {
9    protected function setUp() {
10        parent::setUp();
11    }
12
13    protected function tearDown() {
14        parent::tearDown();
15    }
16
17    /**
18     * DBに商品クラス情報を設定します.
19     */
20    protected function setUpProductClass() {
21        $product_class = array(
22            array(
23                'update_date' => 'CURRENT_TIMESTAMP',
24                'product_class_id' => '1001',
25                'product_id' => '1001',
26                'product_type_id' => '1',
27                'product_code' => 'code1001',
28                'classcategory_id1' => '1001',
29                'classcategory_id2' => '1002',
30                'price01' => '1500',
31                'price02' => '1500',
32                'stock' => '99',
33                'creator_id' => '1',
34                'del_flg' => '0'
35                  ),
36            array(
37                'update_date' => 'CURRENT_TIMESTAMP',
38                'product_class_id' => '1002',
39                'product_id' => '1002',
40                'product_type_id' => '2',
41                'product_code' => 'code1002',
42                'price02' => '2500',
43                'creator_id' => '1',
44                'stock_unlimited' => '1',
45                'del_flg' => '0'
46                  ),
47            array(
48                'update_date' => 'CURRENT_TIMESTAMP',
49                'product_class_id' => '2001',
50                'product_id' => '2001',
51                'product_type_id' => '1',
52                'product_code' => 'code2001',
53                'price02' => '2000',
54                'creator_id' => '1',
55                'stock_unlimited' => '1',
56                'del_flg' => '1'
57                  )
58                               );
59
60        $this->objQuery->delete('dtb_products_class');
61        foreach ($product_class as $key => $item) {
62            $this->objQuery->insert('dtb_products_class', $item);
63        }
64        $this->setUpClassCategory();
65        $this->setUpProducts();
66    }
67
68    /**
69     * DBに製品カテゴリ情報を登録します.
70     */
71    protected function setUpClassCategory() {
72        $class_category = array(
73            array(
74                'update_date' => 'CURRENT_TIMESTAMP',
75                'classcategory_id' => '1001',
76                'class_id' => '1',
77                'creator_id' => '1',
78                'name' => 'cat1001'
79                  ),
80            array(
81                'update_date' => 'CURRENT_TIMESTAMP',
82                'classcategory_id' => '1002',
83                'class_id' => '1',
84                'creator_id' => '1',
85                'name' => 'cat1002'
86                  )
87                                );
88
89        $this->objQuery->delete('dtb_classcategory');
90        foreach ($class_category as $key => $item) {
91            $this->objQuery->insert('dtb_classcategory', $item);
92        }
93    }
94
95    /**
96     * DBに製品情報を登録します.
97     */
98    protected function setUpProducts() {
99        $products = array(
100            array(
101                'update_date' => 'CURRENT_TIMESTAMP',
102                'product_id' => '1001',
103                'name' => '製品名1001',
104                'comment1' => 'コメント10011',
105                'comment2' => 'コメント10012',
106                'comment3' => 'コメント10013',
107                'main_list_comment' => 'リストコメント1001',
108                'main_comment' => 'メインコメント1001',
109                'main_image' => '1001.jpg',
110                'main_list_image' => '1001-main.jpg',
111                'deliv_date_id' => '1',
112                'del_flg' => '0',
113                'creator_id' => '1',
114                'status' => '1'
115                  ),
116            array(
117                'update_date' => 'CURRENT_TIMESTAMP',
118                'product_id' => '1002',
119                'name' => '製品名1002',
120                'comment1' => 'コメント10021',
121                'comment2' => 'コメント10022',
122                'comment3' => 'コメント10023',
123                'main_list_comment' => 'リストコメント1002',
124                'main_image' => '1002.jpg',
125                'main_list_image' => '1002-main.jpg',
126                'deliv_date_id' => '2',
127                'del_flg' => '0',
128                'creator_id' => '1',
129                'status' => '2'
130                  ),
131            array(
132                'update_date' => 'CURRENT_TIMESTAMP',
133                'product_id' => '2001',
134                'name' => '製品名2001',
135                'comment1' => 'コメント20011',
136                'comment2' => 'コメント20012',
137                'comment3' => 'コメント20013',
138                'main_list_comment' => 'リストコメント2001',
139                'main_comment' => 'メインコメント2001',
140                'main_image' => '2001.jpg',
141                'main_list_image' => '2001-main.jpg',
142                'deliv_date_id' => '1',
143                'del_flg' => '1',
144                'creator_id' => '1',
145                'status' => '1'
146                  )
147                          );
148
149        $this->objQuery->delete('dtb_products');
150        foreach ($products as $key => $item) {
151            $this->objQuery->insert('dtb_products', $item);
152        }
153    }
154   
155    /**
156     * DBに商品ステータス情報を登録します.
157     */
158    protected function setUpProductStatus() {
159        $class_category = array(
160            array(
161                'update_date' => 'CURRENT_TIMESTAMP',
162                'product_status_id' => '1',
163                'product_id' => '1001',
164                'creator_id' => '1',
165                'del_flg' => '0'
166                  ),
167            array(
168                'update_date' => 'CURRENT_TIMESTAMP',
169                'product_status_id' => '1',
170                'product_id' => '1002',
171                'creator_id' => '1',
172                'del_flg' => '0'
173                  )
174                                );
175
176        $this->objQuery->delete('dtb_product_status');
177        foreach ($class_category as $key => $item) {
178            $this->objQuery->insert('dtb_product_status', $item);
179        }
180    }
181}
Note: See TracBrowser for help on using the repository browser.