source: branches/version-2_12-multilang/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php @ 22278

Revision 22278, 3.6 KB checked in by m_uehara, 11 years ago (diff)

#1955 r22097 - r22098 , r22104 - r22107 , r22111 - r22120 , r22123 - r22129 , r22133 , r22135 - r22143 , r22145 - r22146 , r22158 , r22164 - r22165 , r22167 - r22169 , r22187 - r22196 , r22199 - r22204, r22219 - r22261 間のコミットをマージします。

  • 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-2012 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::registerOrderDetail()のテストクラス.
29 * TODO 他のfunctionと、SC_Query_Exのインスタンスの受け取り方が異なっている。
30 *
31 * @author Hiroko Tamagawa
32 * @version $Id$
33 */
34class SC_Helper_Purchase_registerOrderDetailTest extends SC_Helper_Purchase_TestBase {
35
36  protected function setUp() {
37    parent::setUp();
38    $this->setUpOrderDetail();
39  }
40
41  protected function tearDown() {
42    parent::tearDown();
43  }
44
45  /////////////////////////////////////////
46  public function testRegisterOrderDetail_該当の受注が存在する場合_削除後に新しい情報が登録される() {
47    $params = array(
48      array(
49      'order_id' => '1001',
50      'hoge' => '999', // DBに存在しないカラム
51      'product_id' => '9001',
52      'product_class_id' => '9001',
53      'product_name' => '製品名9001'
54      )
55    );
56    SC_Helper_Purchase::registerOrderDetail('1001', $params);
57
58    $this->expected['count'] = '2'; // 同じorder_idのものが消されるので1行減る
59    $this->expected['content'] = array(
60      'order_id' => '1001',
61      'product_id' => '9001',
62      'product_class_id' => '9001',
63      'product_name' => '製品名9001',
64      'product_code' => null // 古いデータにはあるが、deleteされたので消えている
65    );
66
67    $this->actual['count'] = $this->objQuery->count('dtb_order_detail');
68    $result = $this->objQuery->select(
69      'order_id, product_id, product_class_id, product_name, product_code',
70      'dtb_order_detail',
71      'order_id = ?',
72      array('1001')
73    );
74    $this->actual['content'] = $result[0];
75
76    $this->verify();
77  }
78
79  public function testRegisterOrderDetail_該当の受注が存在しない場合_新しい情報が追加登録される() {
80    $params = array(
81      array(
82      'order_id' => '1003',
83      'hoge' => '999', // DBに存在しないカラム
84      'product_id' => '9003',
85      'product_class_id' => '9003',
86      'product_name' => '製品名9003'
87      )
88    );
89    SC_Helper_Purchase::registerOrderDetail('1003', $params);
90
91    $this->expected['count'] = '4';
92    $this->expected['content'] = array(
93      'order_id' => '1003',
94      'product_id' => '9003',
95      'product_class_id' => '9003',
96      'product_name' => '製品名9003',
97      'product_code' => null
98    );
99
100    $this->actual['count'] = $this->objQuery->count('dtb_order_detail');
101    $result = $this->objQuery->select(
102      'order_id, product_id, product_class_id, product_name, product_code',
103      'dtb_order_detail',
104      'order_id = ?',
105      array('1003')
106    );
107    $this->actual['content'] = $result[0];
108
109    $this->verify();
110  }
111  //////////////////////////////////////////
112
113}
114
Note: See TracBrowser for help on using the repository browser.