1 | <?php |
---|
2 | |
---|
3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
4 | require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.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_Helper_Purchase::getPaymentsByPrice()のテストクラス. |
---|
29 | * |
---|
30 | * |
---|
31 | * @author Hiroko Tamagawa |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class SC_Helper_Purchase_getPaymentsByPriceTest extends SC_Helper_Purchase_TestBase { |
---|
35 | |
---|
36 | |
---|
37 | protected function setUp() { |
---|
38 | parent::setUp(); |
---|
39 | $this->setUpPayment(); |
---|
40 | $this->setUpPaymentOptions(); |
---|
41 | } |
---|
42 | |
---|
43 | protected function tearDown() { |
---|
44 | parent::tearDown(); |
---|
45 | } |
---|
46 | |
---|
47 | ///////////////////////////////////////// |
---|
48 | public function testGetPaymentsByPrice_購入金額がすべての上限を上回る場合_上限の設定がないものだけ取得できる() { |
---|
49 | $deliv_id = '1003'; |
---|
50 | $total = 21001; |
---|
51 | $helper = new SC_Helper_Purchase(); |
---|
52 | |
---|
53 | $this->expected['count'] = 2; |
---|
54 | $this->expected['first'] = array( |
---|
55 | 'payment_id' => '3002', |
---|
56 | 'payment_method' => '支払方法3002', |
---|
57 | 'rule_max' => null, |
---|
58 | 'upper_rule' => null, |
---|
59 | 'note' => null, |
---|
60 | 'payment_image' => null, |
---|
61 | 'charge' => null |
---|
62 | ); |
---|
63 | $this->expected['second_id'] = '3003'; |
---|
64 | |
---|
65 | $result = $helper->getPaymentsByPrice($total, $deliv_id); |
---|
66 | $this->actual['count'] = count($result); |
---|
67 | $this->actual['first'] = $result[0]; |
---|
68 | $this->actual['second_id'] = $result[1]['payment_id']; |
---|
69 | |
---|
70 | $this->verify(); |
---|
71 | } |
---|
72 | |
---|
73 | public function testGetPaymentsByPrice_購入金額が一部の上限を上回る場合_上限に引っかからないものだけ取得できる() { |
---|
74 | $deliv_id = '1003'; |
---|
75 | $total = 20500; |
---|
76 | $helper = new SC_Helper_Purchase(); |
---|
77 | |
---|
78 | $this->expected = array('3002', '3003', '3005'); |
---|
79 | |
---|
80 | $result = $helper->getPaymentsByPrice($total, $deliv_id); |
---|
81 | $this->actual = Test_Utils::mapCols($result, 'payment_id'); |
---|
82 | |
---|
83 | $this->verify(); |
---|
84 | } |
---|
85 | |
---|
86 | public function testGetPaymentsByPrice_購入金額が一部の下限を下回る場合_下限に引っかからないものだけ取得できる() { |
---|
87 | $deliv_id = '1003'; |
---|
88 | $total = 11000; |
---|
89 | $helper = new SC_Helper_Purchase(); |
---|
90 | |
---|
91 | $this->expected = array('3002', '3003', '3004'); |
---|
92 | |
---|
93 | $result = $helper->getPaymentsByPrice($total, $deliv_id); |
---|
94 | $this->actual = Test_Utils::mapCols($result, 'payment_id'); |
---|
95 | |
---|
96 | $this->verify(); |
---|
97 | } |
---|
98 | |
---|
99 | public function testGetPaymentsByPrice_購入金額がすべての下限を下回る場合_下限の設定がないものだけ取得できる() { |
---|
100 | $deliv_id = '1003'; |
---|
101 | $total = 9999; |
---|
102 | $helper = new SC_Helper_Purchase(); |
---|
103 | |
---|
104 | $this->expected = array('3002', '3004'); |
---|
105 | |
---|
106 | $result = $helper->getPaymentsByPrice($total, $deliv_id); |
---|
107 | $this->actual = Test_Utils::mapCols($result, 'payment_id'); |
---|
108 | |
---|
109 | $this->verify(); |
---|
110 | } |
---|
111 | |
---|
112 | |
---|
113 | ////////////////////////////////////////// |
---|
114 | |
---|
115 | } |
---|
116 | |
---|