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

Revision 22567, 6.1 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

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                  ),
86            array(
87                'update_date' => 'CURRENT_TIMESTAMP',
88                'classcategory_id' => '1002',
89                'class_id' => '1',
90                'creator_id' => '1',
91                'name' => 'cat1002'
92                  )
93                                );
94
95        $this->objQuery->delete('dtb_classcategory');
96        foreach ($class_category as $key => $item) {
97            $this->objQuery->insert('dtb_classcategory', $item);
98        }
99    }
100
101    /**
102     * DBに製品情報を登録します.
103     */
104    protected function setUpProducts()
105    {
106        $products = array(
107            array(
108                'update_date' => 'CURRENT_TIMESTAMP',
109                'product_id' => '1001',
110                'name' => '製品名1001',
111                'comment1' => 'コメント10011',
112                'comment2' => 'コメント10012',
113                'comment3' => 'コメント10013',
114                'main_list_comment' => 'リストコメント1001',
115                'main_comment' => 'メインコメント1001',
116                'main_image' => '1001.jpg',
117                'main_list_image' => '1001-main.jpg',
118                'deliv_date_id' => '1',
119                'del_flg' => '0',
120                'creator_id' => '1',
121                'status' => '1'
122                  ),
123            array(
124                'update_date' => 'CURRENT_TIMESTAMP',
125                'product_id' => '1002',
126                'name' => '製品名1002',
127                'comment1' => 'コメント10021',
128                'comment2' => 'コメント10022',
129                'comment3' => 'コメント10023',
130                'main_list_comment' => 'リストコメント1002',
131                'main_image' => '1002.jpg',
132                'main_list_image' => '1002-main.jpg',
133                'deliv_date_id' => '2',
134                'del_flg' => '0',
135                'creator_id' => '1',
136                'status' => '2'
137                  ),
138            array(
139                'update_date' => 'CURRENT_TIMESTAMP',
140                'product_id' => '2001',
141                'name' => '製品名2001',
142                'comment1' => 'コメント20011',
143                'comment2' => 'コメント20012',
144                'comment3' => 'コメント20013',
145                'main_list_comment' => 'リストコメント2001',
146                'main_comment' => 'メインコメント2001',
147                'main_image' => '2001.jpg',
148                'main_list_image' => '2001-main.jpg',
149                'deliv_date_id' => '1',
150                'del_flg' => '1',
151                'creator_id' => '1',
152                'status' => '1'
153                  )
154                          );
155
156        $this->objQuery->delete('dtb_products');
157        foreach ($products as $key => $item) {
158            $this->objQuery->insert('dtb_products', $item);
159        }
160    }
161   
162    /**
163     * DBに商品ステータス情報を登録します.
164     */
165    protected function setUpProductStatus()
166    {
167        $class_category = array(
168            array(
169                'update_date' => 'CURRENT_TIMESTAMP',
170                'product_status_id' => '1',
171                'product_id' => '1001',
172                'creator_id' => '1',
173                'del_flg' => '0'
174                  ),
175            array(
176                'update_date' => 'CURRENT_TIMESTAMP',
177                'product_status_id' => '1',
178                'product_id' => '1002',
179                'creator_id' => '1',
180                'del_flg' => '0'
181                  )
182                                );
183
184        $this->objQuery->delete('dtb_product_status');
185        foreach ($class_category as $key => $item) {
186            $this->objQuery->insert('dtb_product_status', $item);
187        }
188    }
189}
Note: See TracBrowser for help on using the repository browser.