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

Revision 22567, 3.0 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

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
37  protected function setUp()
38  {
39    parent::setUp();
40  }
41
42  protected function tearDown()
43  {
44    parent::tearDown();
45  }
46
47  /////////////////////////////////////////
48  public function testSaveShippingTemp_元々存在しない配送先IDの場合_新規に配列が作られる()
49  {
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
70  public function testSaveShippingTemp_元々存在する配送先IDの場合_情報がマージされる()
71  {
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
Note: See TracBrowser for help on using the repository browser.