source: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPriceTest.php @ 22567

Revision 22567, 3.5 KB checked in by shutta, 9 years ago (diff)

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

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