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