source: branches/version-2_13-dev/tests/class/SC_Product/SC_Product_TestBase.php @ 23543

Revision 23543, 6.3 KB checked in by shutta, 10 years ago (diff)

#2558 商品管理>商品登録(商品規格) dtb_classcategory.del_flg を関知していない
r23541 では不十分だったので、残りの1失敗(MySQL)への修正。

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