1 | <?php |
---|
2 | |
---|
3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
4 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
---|
5 | /* |
---|
6 | * This file is part of EC-CUBE |
---|
7 | * |
---|
8 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
9 | * |
---|
10 | * http://www.lockon.co.jp/ |
---|
11 | * |
---|
12 | * This program is free software; you can redistribute it and/or |
---|
13 | * modify it under the terms of the GNU General Public License |
---|
14 | * as published by the Free Software Foundation; either version 2 |
---|
15 | * of the License, or (at your option) any later version. |
---|
16 | * |
---|
17 | * This program is distributed in the hope that it will be useful, |
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
20 | * GNU General Public License for more details. |
---|
21 | * |
---|
22 | * You should have received a copy of the GNU General Public License |
---|
23 | * along with this program; if not, write to the Free Software |
---|
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
25 | */ |
---|
26 | |
---|
27 | /** |
---|
28 | * SC_Utils::sfGetProductClassId()のテストクラス. |
---|
29 | * TODO del_flgは使わなくて良い?? |
---|
30 | * TODO classcategory_id1とclasscategory_id2を使わないと一意に指定できない。 |
---|
31 | * @author Hiroko Tamagawa |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class SC_Utils_sfGetProductClassIdTest extends Common_TestCase { |
---|
35 | |
---|
36 | |
---|
37 | protected function setUp() { |
---|
38 | parent::setUp(); |
---|
39 | $this->setUpProductsClass(); |
---|
40 | } |
---|
41 | |
---|
42 | protected function tearDown() { |
---|
43 | parent::tearDown(); |
---|
44 | } |
---|
45 | |
---|
46 | ///////////////////////////////////////// |
---|
47 | public function testSfGetProductClassId_存在するIDを指定した場合_対応する製品クラスが取得できる() { |
---|
48 | |
---|
49 | $this->expected = '1001'; |
---|
50 | $this->actual = SC_Utils::sfGetProductClassId('1001'); |
---|
51 | |
---|
52 | $this->verify('取得した製品クラス'); |
---|
53 | } |
---|
54 | |
---|
55 | public function testSfGetProductClassId_存在しないIDを指定した場合_nullが返る() { |
---|
56 | $this->expected = null; |
---|
57 | $this->actual = SC_Utils::sfGetProductClassId('9999'); |
---|
58 | |
---|
59 | $this->verify('取得結果が空'); |
---|
60 | } |
---|
61 | |
---|
62 | ////////////////////////////////////////// |
---|
63 | protected function setUpProductsClass() { |
---|
64 | $products_class = array( |
---|
65 | array( |
---|
66 | 'product_class_id' => '2001', |
---|
67 | 'product_id' => '2001', |
---|
68 | 'price02' => '1000', |
---|
69 | 'creator_id' => '1', |
---|
70 | 'update_date' => 'CURRENT_TIMESTAMP' |
---|
71 | ), |
---|
72 | array( |
---|
73 | 'product_class_id' => '1001', |
---|
74 | 'product_id' => '1001', |
---|
75 | 'price02' => '1000', |
---|
76 | 'classcategory_id1' => '1', |
---|
77 | 'creator_id' => '1', |
---|
78 | 'update_date' => 'CURRENT_TIMESTAMP' |
---|
79 | ) |
---|
80 | /** 同じproduct_idが2つあるケースは現状failするのでいったんコメントアウト |
---|
81 | array( |
---|
82 | 'product_class_id' => '1002', |
---|
83 | 'product_id' => '1001', |
---|
84 | 'price02' => '1000', |
---|
85 | 'classcategory_id1' => '2', |
---|
86 | 'creator_id' => '1', |
---|
87 | 'update_date' => 'CURRENT_TIMESTAMP' |
---|
88 | ) |
---|
89 | */ |
---|
90 | ); |
---|
91 | |
---|
92 | $this->objQuery->delete('dtb_products_class'); |
---|
93 | foreach ($products_class as $item) { |
---|
94 | $this->objQuery->insert('dtb_products_class', $item); |
---|
95 | } |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|