source: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php @ 22796

Revision 22796, 3.0 KB checked in by h_yoshimoto, 11 years ago (diff)

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

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