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

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

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

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