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-2012 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::cleanupSession()のテストクラス. |
---|
29 | * |
---|
30 | * |
---|
31 | * @author Hiroko Tamagawa |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class SC_Helper_Purchase_cleanupSessionTest extends SC_Helper_Purchase_TestBase { |
---|
35 | |
---|
36 | protected function setUp() { |
---|
37 | parent::setUp(); |
---|
38 | $this->setUpProductClass(); |
---|
39 | } |
---|
40 | |
---|
41 | protected function tearDown() { |
---|
42 | parent::tearDown(); |
---|
43 | } |
---|
44 | |
---|
45 | ///////////////////////////////////////// |
---|
46 | public function testCleanupSession__カートとセッションの配送情報が削除される() { |
---|
47 | // 引数の準備 |
---|
48 | $helper = new SC_Helper_Purchase(); |
---|
49 | $cartSession = new SC_CartSession(); |
---|
50 | $customer = new SC_Customer(); |
---|
51 | |
---|
52 | // 削除前のデータを設定 |
---|
53 | $cartSession->addProduct('1001', 5); // product_type_id=1 |
---|
54 | $cartSession->addProduct('1002', 10); // product_type_id=2 |
---|
55 | $_SESSION['site']['uniqid'] = '100001'; |
---|
56 | |
---|
57 | $helper->cleanupSession('1001', $cartSession, $customer, '1'); |
---|
58 | |
---|
59 | $this->expected = array( |
---|
60 | 'cart_max_deleted' => 0, |
---|
61 | 'cart_max_notdeleted' => 1, |
---|
62 | 'uniqid' => '', |
---|
63 | 'shipping' => null, |
---|
64 | 'multiple_temp' => null |
---|
65 | ); |
---|
66 | |
---|
67 | $this->actual['cart_max_deleted'] = $cartSession->getMax('1'); |
---|
68 | $this->actual['cart_max_notdeleted'] = $cartSession->getMax('2'); |
---|
69 | $this->actual['uniqid'] = $_SESSION['site']['uniqid']; |
---|
70 | $this->actual['shipping'] = $_SESSION['shipping']; |
---|
71 | $this->actual['multiple_temp'] = $_SESSION['multiple_temp']; |
---|
72 | |
---|
73 | $this->verify(); |
---|
74 | } |
---|
75 | |
---|
76 | ////////////////////////////////////////// |
---|
77 | |
---|
78 | } |
---|
79 | |
---|