source: branches/version-2_13-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php @ 22960

Revision 22960, 3.4 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 語句統一「全て」
  • Property svn:keywords set to Id Rev Date
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::copyFromOrder()のテストクラス.
29 *
30 *
31 * @author Hiroko Tamagawa
32 * @version $Id$
33 */
34class SC_Helper_Purchase_copyFromOrderTest extends SC_Helper_Purchase_TestBase
35{
36
37
38  protected function setUp()
39  {
40    // parent::setUp();
41  }
42
43  protected function tearDown()
44  {
45    // parent::tearDown();
46  }
47
48  /////////////////////////////////////////
49  public function testCopyFromOrder_全てデフォルト設定にした場合_デフォルトの接頭辞・キーでコピーされる()
50  {
51     $dest = array();
52     $src = array(
53       'order_name01' => '姓',
54       'order_name02' => '名',
55       'order_kana01' => 'セイ',
56       'order_kana02' => 'メイ',
57       'order_sex' => '1',
58       'order_zip01' => '012',
59       'order_zip02' => '1234',
60       'order_pref' => '北海道',
61       'order_addr01' => '住所01',
62       'order_addr02' => '住所02',
63       'order_tel01' => '01',
64       'order_tel02' => '1234',
65       'order_tel03' => '5678',
66       'order_fax01' => '02',
67       'order_fax02' => '2345',
68       'order_fax03' => '6789'
69     );
70
71     $this->expected = array(
72       'shipping_name01' => '姓',
73       'shipping_name02' => '名',
74       'shipping_kana01' => 'セイ',
75       'shipping_kana02' => 'メイ',
76       'shipping_sex' => '1',
77       'shipping_zip01' => '012',
78       'shipping_zip02' => '1234',
79       'shipping_pref' => '北海道',
80       'shipping_addr01' => '住所01',
81       'shipping_addr02' => '住所02',
82       'shipping_tel01' => '01',
83       'shipping_tel02' => '1234',
84       'shipping_tel03' => '5678',
85       'shipping_fax01' => '02',
86       'shipping_fax02' => '2345',
87       'shipping_fax03' => '6789'
88     );
89     $helper = new SC_Helper_Purchase();
90     $helper->copyFromOrder($dest, $src);
91     $this->actual = $dest;
92
93     $this->verify();
94  }
95
96  public function testCopyFromOrder_接頭辞・キーを設定した場合_指定の値でコピーされる()
97  {
98     $dest = array();
99     $src = array(
100       'input_name01' => '姓',
101       'input_name02' => '名',
102       'input_zip01' => '012' // キーに含まれないもの
103     );
104
105     $this->expected = array(
106       'output_name01' => '姓',
107       'output_name02' => '名'
108     );
109     $helper = new SC_Helper_Purchase();
110     $helper->copyFromOrder($dest, $src, 'output', 'input', array('name01', 'name02'));
111     $this->actual = $dest;
112
113     $this->verify();
114  }
115  //////////////////////////////////////////
116}
117
Note: See TracBrowser for help on using the repository browser.