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