[22128] | 1 | <?php |
---|
| 2 | |
---|
| 3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
[22135] | 4 | require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php"); |
---|
[22202] | 5 | /* |
---|
| 6 | * This file is part of EC-CUBE |
---|
| 7 | * |
---|
[22206] | 8 | * Copyright(c) 2000-2013 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 | |
---|
[22128] | 27 | /** |
---|
[22202] | 28 | * SC_Helper_Purchase::saveShippingTemp()のテストクラス. |
---|
[22128] | 29 | * |
---|
[22202] | 30 | * |
---|
| 31 | * @author Hiroko Tamagawa |
---|
| 32 | * @version $Id$ |
---|
[22128] | 33 | */ |
---|
[22567] | 34 | class SC_Helper_Purchase_saveShippingTempTest extends SC_Helper_Purchase_TestBase |
---|
| 35 | { |
---|
[22128] | 36 | |
---|
[22567] | 37 | protected function setUp() |
---|
| 38 | { |
---|
[22128] | 39 | parent::setUp(); |
---|
| 40 | } |
---|
| 41 | |
---|
[22567] | 42 | protected function tearDown() |
---|
| 43 | { |
---|
[22128] | 44 | parent::tearDown(); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | ///////////////////////////////////////// |
---|
[22567] | 48 | public function testSaveShippingTemp_元々存在しない配送先IDの場合_新規に配列が作られる() |
---|
| 49 | { |
---|
[22128] | 50 | $this->setUpShipping($this->getMultipleShipping()); |
---|
| 51 | |
---|
| 52 | SC_Helper_Purchase::saveShippingTemp( |
---|
| 53 | array('shipment_item' => '商品4', 'shipping_pref' => '大阪府') |
---|
| 54 | ); |
---|
| 55 | |
---|
| 56 | $this->expected = array( |
---|
| 57 | 'count'=>4, // 配送情報全体の件数 |
---|
| 58 | 'shipping_id'=>0, |
---|
| 59 | 'shipment_item'=>null, |
---|
| 60 | 'shipping_pref'=>'大阪府' |
---|
| 61 | ); |
---|
| 62 | $this->actual['count'] = count($_SESSION['shipping']); |
---|
| 63 | $this->actual['shipping_id'] = $_SESSION['shipping']['0']['shipping_id']; |
---|
| 64 | $this->actual['shipment_item'] = $_SESSION['shipping']['0']['shipment_item']; |
---|
| 65 | $this->actual['shipping_pref'] = $_SESSION['shipping']['0']['shipping_pref']; |
---|
| 66 | |
---|
| 67 | $this->verify('登録した配送情報'); |
---|
| 68 | } |
---|
| 69 | |
---|
[22567] | 70 | public function testSaveShippingTemp_元々存在する配送先IDの場合_情報がマージされる() |
---|
| 71 | { |
---|
[22128] | 72 | $this->setUpShipping($this->getMultipleShipping()); |
---|
| 73 | |
---|
| 74 | SC_Helper_Purchase::saveShippingTemp( |
---|
| 75 | array('shipment_item' => '商品4', 'shipping_pref' => '大阪府'), |
---|
| 76 | '00001' |
---|
| 77 | ); |
---|
| 78 | |
---|
| 79 | $this->expected = array( |
---|
| 80 | 'count'=>3, // 配送情報全体の件数 |
---|
| 81 | 'shipping_id'=>'00001', |
---|
| 82 | 'shipment_item'=>array('商品1'), |
---|
| 83 | 'shipping_pref'=>'大阪府' |
---|
| 84 | ); |
---|
| 85 | $this->actual['count'] = count($_SESSION['shipping']); |
---|
| 86 | $this->actual['shipping_id'] = $_SESSION['shipping']['00001']['shipping_id']; |
---|
| 87 | $this->actual['shipment_item'] = $_SESSION['shipping']['00001']['shipment_item']; |
---|
| 88 | $this->actual['shipping_pref'] = $_SESSION['shipping']['00001']['shipping_pref']; |
---|
| 89 | |
---|
| 90 | $this->verify('更新した配送情報'); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | } |
---|
| 94 | |
---|