source: branches/version-2_13-dev/tests/class/SC_Product/SC_Product_getProductsClassByProductIdsTest.php @ 23555

Revision 23555, 4.3 KB checked in by shutta, 10 years ago (diff)

#1993 [共通クラス]SC_Product
dtb_classテーブルのデータ初期化が漏れていたので追加。(必要なデータはクラス内で用意させる)
setUp周りの冗長な処理を改善。

Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../..";
4require_once($HOME . "/tests/class/SC_Product/SC_Product_TestBase.php");
5/**
6 *
7 */
8class SC_Product_getProductsClassByProductIdsTest extends SC_Product_TestBase
9{
10
11    protected function setUp()
12    {
13        parent::setUp();
14        $this->setUpProductClass();
15        $this->objProducts = new SC_Product_Ex();
16    }
17
18    protected function tearDown()
19    {
20        parent::tearDown();
21    }
22
23    /////////////////////////////////////////
24
25    public function testGetProductsClassByProductIds_商品IDなしは空配列を返す()
26    {
27        $this->expected = array();
28       
29        $productIds = array();
30
31        $this->actual = $this->objProducts->getProductsClassByProductIds($productIds);
32
33        $this->verify('商品ID指定なし');
34    }
35   
36    public function testGetProductsClassByProductIds_指定の商品IDの情報を返す()
37    {
38        $this->expected = array(
39            0=> array(
40                'product_id' => '1001'
41                ,'del_flg' => '0'
42                ,'point_rate' => '0'
43                ,'stock' => '99'
44                ,'stock_unlimited' => '0'
45                ,'sale_limit' => null
46                ,'price01' => '1500'
47                ,'price02' => '1500'
48                ,'product_code' => 'code1001'
49                ,'product_class_id' => '1001'
50                ,'product_type_id' => '1'
51                ,'down_filename' => null
52                ,'down_realfilename' => null
53                ,'classcategory_name1' => 'cat1001'
54                ,'rank1' => '1'
55                ,'class_name1' => '味'
56                ,'class_id1' => '1'
57                ,'classcategory_id1' => '1001'
58                ,'classcategory_id2' => '1002'
59                ,'classcategory_name2' => 'cat1002'
60                ,'rank2' => '2'
61                ,'class_name2' => '味'
62                ,'class_id2' => '1'
63            )
64        );
65       
66        $productIds = array('1001','2001');
67
68        $this->actual = $this->objProducts->getProductsClassByProductIds($productIds);
69
70        $this->verify('商品ID指定');
71    }
72   
73    public function testGetProductsClassByProductIds_削除商品含む商品情報を返す()
74    {
75        $this->expected = array(
76            0=> array(
77                'product_id' => '1001'
78                ,'del_flg' => '0'
79                ,'point_rate' => '0'
80                ,'stock' => '99'
81                ,'stock_unlimited' => '0'
82                ,'sale_limit' => null
83                ,'price01' => '1500'
84                ,'price02' => '1500'
85                ,'product_code' => 'code1001'
86                ,'product_class_id' => '1001'
87                ,'product_type_id' => '1'
88                ,'down_filename' => null
89                ,'down_realfilename' => null
90                ,'classcategory_name1' => 'cat1001'
91                ,'rank1' => '1'
92                ,'class_name1' => '味'
93                ,'class_id1' => '1'
94                ,'classcategory_id1' => '1001'
95                ,'classcategory_id2' => '1002'
96                ,'classcategory_name2' => 'cat1002'
97                ,'rank2' => '2'
98                ,'class_name2' => '味'
99                ,'class_id2' => '1'
100            ),
101            1=> array(
102                'product_id' => '2001'
103                ,'del_flg' => '1'
104                ,'point_rate' => '0'
105                ,'stock' => null
106                ,'stock_unlimited' => '1'
107                ,'sale_limit' => null
108                ,'price01' => null
109                ,'price02' => '2000'
110                ,'product_code' => 'code2001'
111                ,'product_class_id' => '2001'
112                ,'product_type_id' => '1'
113                ,'down_filename' => null
114                ,'down_realfilename' => null
115                ,'classcategory_name1' => null
116                ,'rank1' => 0
117                ,'class_name1' => null
118                ,'class_id1' => null
119                ,'classcategory_id1' => '0'
120                ,'classcategory_id2' => '0'
121                ,'classcategory_name2' => null
122                ,'rank2' => 0
123                ,'class_name2' => null
124                ,'class_id2' => null
125            )
126        );
127       
128        $productIds = array('1001','2001');
129
130        $this->actual = $this->objProducts->getProductsClassByProductIds($productIds,true);
131
132        $this->verify('商品ID指定');
133    }
134   
135   
136}
Note: See TracBrowser for help on using the repository browser.