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::setDownloadableFlgTo()のテストクラス. |
---|
29 | * |
---|
30 | * |
---|
31 | * @author Hiroko Tamagawa |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class SC_Helper_Purchase_setDownloadableFlgToTest extends SC_Helper_Purchase_TestBase |
---|
35 | { |
---|
36 | |
---|
37 | |
---|
38 | protected function setUp() |
---|
39 | { |
---|
40 | // parent::setUp(); |
---|
41 | } |
---|
42 | |
---|
43 | protected function tearDown() |
---|
44 | { |
---|
45 | // parent::tearDown(); |
---|
46 | } |
---|
47 | |
---|
48 | ///////////////////////////////////////// |
---|
49 | public function testSetDownloadableFlgTo_販売価格が0円の場合_フラグがONになる() |
---|
50 | { |
---|
51 | $input = array( |
---|
52 | '1001' => array('price' => 0) |
---|
53 | ); |
---|
54 | |
---|
55 | $this->expected = true; |
---|
56 | SC_Helper_Purchase::setDownloadableFlgTo($input); |
---|
57 | $this->actual = $input['1001']['is_downloadable']; |
---|
58 | |
---|
59 | $this->verify('ダウンロード可能フラグ設定結果'); |
---|
60 | } |
---|
61 | |
---|
62 | public function testSetDownloadableFlgTo_ダウンロード期限内かつ入金日ありの場合_フラグがONになる() |
---|
63 | { |
---|
64 | $input = array( |
---|
65 | '1001' => array('price' => 1000, 'effective' => '1', 'payment_date' => '2012-12-12') |
---|
66 | ); |
---|
67 | |
---|
68 | $this->expected = true; |
---|
69 | SC_Helper_Purchase::setDownloadableFlgTo($input); |
---|
70 | $this->actual = $input['1001']['is_downloadable']; |
---|
71 | |
---|
72 | $this->verify('ダウンロード可能フラグ設定結果'); |
---|
73 | } |
---|
74 | |
---|
75 | public function testSetDownloadableFlgTo_ダウンロード期限内かつ入金日なしの場合_フラグがOFFになる() |
---|
76 | { |
---|
77 | $input = array( |
---|
78 | '1001' => array('price' => 1000, 'effective' => '1', 'payment_date' => null) |
---|
79 | ); |
---|
80 | |
---|
81 | $this->expected = false; |
---|
82 | SC_Helper_Purchase::setDownloadableFlgTo($input); |
---|
83 | $this->actual = $input['1001']['is_downloadable']; |
---|
84 | |
---|
85 | $this->verify('ダウンロード可能フラグ設定結果'); |
---|
86 | } |
---|
87 | |
---|
88 | public function testSetDownloadableFlgTo_ダウンロード期限外かつ入金日ありの場合_フラグがOFFになる() |
---|
89 | { |
---|
90 | $input = array( |
---|
91 | '1001' => array('price' => 1000, 'effective' => '0', 'payment_date' => '2012-12-12') |
---|
92 | ); |
---|
93 | |
---|
94 | $this->expected = false; |
---|
95 | SC_Helper_Purchase::setDownloadableFlgTo($input); |
---|
96 | $this->actual = $input['1001']['is_downloadable']; |
---|
97 | |
---|
98 | $this->verify('ダウンロード可能フラグ設定結果'); |
---|
99 | } |
---|
100 | |
---|
101 | public function testSetDownloadableFlgTo_ダウンロード期限外かつ入金日なしの場合_フラグがOFFになる() |
---|
102 | { |
---|
103 | $input = array( |
---|
104 | '1001' => array('price' => 1000, 'effective' => '0', 'payment_date' => null) |
---|
105 | ); |
---|
106 | |
---|
107 | $this->expected = false; |
---|
108 | SC_Helper_Purchase::setDownloadableFlgTo($input); |
---|
109 | $this->actual = $input['1001']['is_downloadable']; |
---|
110 | |
---|
111 | $this->verify('ダウンロード可能フラグ設定結果'); |
---|
112 | } |
---|
113 | |
---|
114 | ////////////////////////////////////////// |
---|
115 | } |
---|
116 | |
---|