[22204] | 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::setShipmentItemTemp()のテストクラス. |
---|
| 29 | * 【注意】dtb_baseinfoはインストール時に入るデータをそのまま使用 |
---|
| 30 | * |
---|
| 31 | * @author Hiroko Tamagawa |
---|
| 32 | * @version $Id$ |
---|
| 33 | */ |
---|
| 34 | class SC_Helper_Purchase_setShipmentItemTempTest extends SC_Helper_Purchase_TestBase { |
---|
| 35 | private $helper; |
---|
| 36 | |
---|
| 37 | protected function setUp() { |
---|
| 38 | parent::setUp(); |
---|
| 39 | $this->setUpProductClass(); |
---|
| 40 | $this->setUpProducts(); |
---|
| 41 | |
---|
| 42 | $_SESSION['shipping']['1001']['shipment_item'] = array( |
---|
| 43 | '1001' => array('productsClass' => array('price02' => 9000)) |
---|
| 44 | ); |
---|
| 45 | $this->helper = new SC_Helper_Purchase(); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | protected function tearDown() { |
---|
| 49 | parent::tearDown(); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | ///////////////////////////////////////// |
---|
| 53 | public function testSetShipmentItemTemp_製品情報が既に存在する場合_存在する情報が価格に反映される() { |
---|
| 54 | $this->helper->setShipmentItemTemp('1001', '1001', 10); |
---|
| 55 | |
---|
| 56 | $this->expected = array( |
---|
| 57 | 'shipping_id' => '1001', |
---|
| 58 | 'product_class_id' => '1001', |
---|
| 59 | 'quantity' => 10, |
---|
| 60 | 'price' => 9000, |
---|
| 61 | 'total_inctax' => 94500.0, |
---|
| 62 | 'productsClass' => array('price02' => 9000) |
---|
| 63 | ); |
---|
| 64 | $this->actual = $_SESSION['shipping']['1001']['shipment_item']['1001']; |
---|
| 65 | |
---|
| 66 | $this->verify(); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | public function testSetShipmentItemTemp_製品情報が存在しない場合_DBから取得した値が反映される() { |
---|
| 70 | $this->helper->setShipmentItemTemp('1001', '1002', 10); |
---|
| 71 | |
---|
| 72 | $this->expected = array( |
---|
| 73 | 'shipping_id' => '1001', |
---|
| 74 | 'product_class_id' => '1002', |
---|
| 75 | 'quantity' => 10, |
---|
| 76 | 'price' => '2500', |
---|
| 77 | 'total_inctax' => 26250.0 |
---|
| 78 | ); |
---|
| 79 | $result = $_SESSION['shipping']['1001']['shipment_item']['1002']; |
---|
| 80 | unset($result['productsClass']); |
---|
| 81 | $this->actual = $result; |
---|
| 82 | |
---|
| 83 | $this->verify(); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | ////////////////////////////////////////// |
---|
| 87 | |
---|
| 88 | } |
---|
| 89 | |
---|