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

Revision 22857, 4.8 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::getShipmentItems()のテストクラス.
29 *
30 *
31 * @author Hiroko Tamagawa
32 * @version $Id$
33 */
34class SC_Helper_Purchase_getShipmentItemsTest extends SC_Helper_Purchase_TestBase
35{
36
37  protected function setUp()
38  {
39    parent::setUp();
40    $this->setUpShipmentItem();
41  }
42
43  protected function tearDown()
44  {
45    parent::tearDown();
46  }
47
48  /////////////////////////////////////////
49  public function testGetShipmentItems_存在しない受注IDを指定した場合_結果が空になる()
50  {
51    $order_id = '100'; // 存在しないID
52    $shipping_id = '1';
53
54    $this->expected = array();
55    $this->actual = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id);
56
57    $this->verify('配送情報');
58  }
59
60  public function testGetShipmentItems_存在しない配送先IDを指定した場合_結果が空になる()
61  {
62    $order_id = '1';
63    $shipping_id = '100'; // 存在しないID
64
65    $this->expected = array();
66    $this->actual = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id);
67
68    $this->verify('配送情報');
69  }
70
71  public function testGetShipmentItems_存在する受注IDと配送先IDを指定した場合_結果が取得できる()
72  {
73    $order_id = '1';
74    $shipping_id = '1';
75   
76    $this->expected['count'] = 2;
77    $this->expected['first'] = array(
78      'order_id' => '1',
79      'shipping_id' => '1',
80      'product_class_id' => '1001',
81      'product_name' => '商品名01',
82      'price' => '1500',
83      'productsClass' => array('product_class_id' => '1001', 'product_id' => '1001')
84    );
85    $this->expected['second'] = array(
86      'order_id' => '1',
87      'shipping_id' => '1',
88      'product_class_id' => '1002',
89      'product_name' => '商品名02',
90      'price' => '2400',
91      'productsClass' => array('product_class_id' => '1002', 'product_id' => '1002')
92    );
93
94    $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id);
95    $this->actual['count'] = count($result);
96    $this->actual['first'] = Test_Utils::mapArray($result[0], array(
97      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
98    $this->actual['first']['productsClass'] = Test_Utils::mapArray($this->actual['first']['productsClass'], array('product_class_id', 'product_id'));
99    $this->actual['second'] = Test_Utils::mapArray($result[1], array(
100      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
101    $this->actual['second']['productsClass'] = Test_Utils::mapArray($this->actual['second']['productsClass'], array('product_class_id', 'product_id'));
102    $this->verify('配送情報');
103  }
104
105  public function testGetShipmentItems_詳細フラグをOFFにした場合_結果に詳細情報が含まれない()
106  {
107    $order_id = '1';
108    $shipping_id = '1';
109   
110    $this->expected['count'] = 2;
111    $this->expected['first'] = array(
112      'order_id' => '1',
113      'shipping_id' => '1',
114      'product_class_id' => '1001',
115      'product_name' => '商品名01',
116      'price' => '1500',
117      'productsClass' => null
118    );
119    $this->expected['second'] = array(
120      'order_id' => '1',
121      'shipping_id' => '1',
122      'product_class_id' => '1002',
123      'product_name' => '商品名02',
124      'price' => '2400',
125      'productsClass' => null
126    );
127
128    $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id, false);
129    $this->actual['count'] = count($result);
130    $this->actual['first'] = Test_Utils::mapArray($result[0], array(
131      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
132    $this->actual['second'] = Test_Utils::mapArray($result[1], array(
133      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
134    $this->verify('配送情報');
135  }
136
137  //////////////////////////////////////////
138}
139
Note: See TracBrowser for help on using the repository browser.