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

Revision 22188, 3.3 KB checked in by nanasess, 11 years ago (diff)

#1993 ([共通クラス]SC_Products)

基底クラスと, 以下を追加

  • SC_Product::findProductIdsOrder
  • SC_Product_setProductsOrder
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' => '1001',
27                'product_code' => 'code1001',
28                'classcategory_id1' => '1001',
29                'classcategory_id2' => '1002',
30                'price01' => '1500',
31                'price02' => '1500',
32                'creator_id' => '1',
33                'del_flg' => '0'
34                  ),
35            array(
36                'update_date' => 'CURRENT_TIMESTAMP',
37                'product_class_id' => '1002',
38                'product_id' => '1002',
39                'product_type_id' => '1002',
40                'price02' => '2500',
41                'creator_id' => '1',
42                'del_flg' => '0'
43                  )
44                               );
45
46        $this->objQuery->delete('dtb_products_class');
47        foreach ($product_class as $key => $item) {
48            $this->objQuery->insert('dtb_products_class', $item);
49        }
50        $this->setUpClassCategory();
51        $this->setUpProducts();
52    }
53
54    /**
55     * DBに製品カテゴリ情報を登録します.
56     */
57    protected function setUpClassCategory() {
58        $class_category = array(
59            array(
60                'update_date' => 'CURRENT_TIMESTAMP',
61                'classcategory_id' => '1001',
62                'class_id' => '1',
63                'creator_id' => '1',
64                'name' => 'cat1001'
65                  ),
66            array(
67                'update_date' => 'CURRENT_TIMESTAMP',
68                'classcategory_id' => '1002',
69                'class_id' => '1',
70                'creator_id' => '1',
71                'name' => 'cat1002'
72                  )
73                                );
74
75        $this->objQuery->delete('dtb_classcategory');
76        foreach ($class_category as $key => $item) {
77            $this->objQuery->insert('dtb_classcategory', $item);
78        }
79    }
80
81    /**
82     * DBに製品情報を登録します.
83     */
84    protected function setUpProducts() {
85        $products = array(
86            array(
87                'update_date' => 'CURRENT_TIMESTAMP',
88                'product_id' => '1001',
89                'name' => '製品名1001',
90                'del_flg' => '0',
91                'creator_id' => '1',
92                'status' => '1'
93                  ),
94            array(
95                'update_date' => 'CURRENT_TIMESTAMP',
96                'product_id' => '1002',
97                'name' => '製品名1002',
98                'del_flg' => '0',
99                'creator_id' => '1',
100                'status' => '2'
101                  )
102                          );
103
104        $this->objQuery->delete('dtb_products');
105        foreach ($products as $key => $item) {
106            $this->objQuery->insert('dtb_products', $item);
107        }
108    }
109}
Note: See TracBrowser for help on using the repository browser.