[Svn-src-all:3257] [version-2_12-dev 22158] MySQL/PostgreSQLエラー修正、テストケース追加
shift_hiroko.tamagawa
admin @ mail.ec-cube.net
2012年 12月 25日 (火) 22:47:45 JST
Subversion committed to /home/svn/open 22158
http://svn.ec-cube.net/open_trac/changeset/22158
┌────────────────────────────┐
│更新者 : shift_hiroko.tamagawa │
│更新日時: 2012-12-25 22:47:45 +0900 (火, 25 12月 2012)│
└────────────────────────────┘
Log:
--------------------------------------------------------
MySQL/PostgreSQLエラー修正、テストケース追加
Changed: [U:修正,A:追加,D:削除]
--------------------------------------------------------
U branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php
A branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderNameColTest.php
U branches/version-2_12-dev/tests/class/test/util/User_Utils.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php
変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php 2012-12-21 06:56:41 UTC (rev 22157)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php 2012-12-25 13:47:45 UTC (rev 22158)
@@ -69,6 +69,12 @@
'order_id' => '2',
'shipping_name01' => '配送情報02',
'shipping_date' => '2011-10-01'
+ ),
+ array(
+ 'shipping_id' => '1002',
+ 'order_id' => '1002',
+ 'shipping_time' => '午後',
+ 'time_id' => '1'
)
);
@@ -241,24 +247,28 @@
'product_type_id' => '1001',
'name' => '配送業者del',
'rank' => '1',
+ 'creator_id' => '1',
'del_flg' => '1'
),
array(
'deliv_id' => '1001',
'product_type_id' => '1001',
'name' => '配送業者01',
+ 'creator_id' => '1',
'rank' => '2'
),
array(
'deliv_id' => '1002',
'product_type_id' => '1001',
'name' => '配送業者02',
+ 'creator_id' => '1',
'rank' => '3'
),
array( // 商品種別違い
'deliv_id' => '1004',
'product_type_id' => '2001',
'name' => '配送業者21',
+ 'creator_id' => '1',
'rank' => '4'
),
);
@@ -360,7 +370,10 @@
array(
'order_id' => '1002',
'customer_id' => '1002',
- 'order_name01' => '受注情報02'
+ 'order_name01' => '受注情報02',
+ 'payment_id' => '1002',
+ 'payment_method' => '支払方法1001',
+ 'deliv_id' => '1002'
)
);
@@ -382,7 +395,9 @@
array(
'order_temp_id' => '1002',
'customer_id' => '1002',
- 'order_name01' => '受注情報02'
+ 'order_name01' => '受注情報02',
+ 'payment_id' => '1002',
+ 'payment_method' => '支払方法1001'
)
);
追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderNameColTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderNameColTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderNameColTest.php 2012-12-25 13:47:45 UTC (rev 22158)
@@ -0,0 +1,99 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Helper_Purchase::sfUpdateOrderNameCol()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_sfUpdateOrderNameColTest extends SC_Helper_Purchase_TestBase {
+ var $helper;
+
+ protected function setUp() {
+ parent::setUp();
+ $this->setUpOrder();
+ $this->setUpOrderTemp();
+ $this->setUpPayment();
+ $this->setUpDeliv();
+ $this->setUpDelivTime();
+ $this->setUpShippingOnDb();
+
+ $this->helper = new SC_Helper_Purchase();
+ }
+
+ protected function tearDown() {
+ parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfUpdateOrderNameCol_TEMPフラグがOFFの場合_受注テーブルと発送テーブルが更新される() {
+ $order_id = '1002';
+
+ $this->helper->sfUpdateOrderNameCol($order_id);
+
+ $this->expected['shipping'] = array(array('shipping_time' => '午前'));
+ $this->expected['order'] = array(array('payment_method' => '支払方法1002'));
+ $this->expected['order_temp'] = array(array('payment_method' => '支払方法1001')); // 変更されていない
+
+ $this->actual['shipping'] = $this->objQuery->select(
+ 'shipping_time', 'dtb_shipping', 'order_id = ?', array($order_id)
+ );
+ $this->actual['order'] = $this->objQuery->select(
+ 'payment_method', 'dtb_order', 'order_id = ?', array($order_id)
+ );
+ $this->actual['order_temp'] = $this->objQuery->select(
+ 'payment_method', 'dtb_order_temp', 'order_temp_id = ?', array($order_id)
+ );
+ $this->verify();
+ }
+
+ public function testSfUpdateOrderNameCol_TEMPフラグがONの場合_一時テーブルが更新される() {
+ $order_id = '1002';
+
+ $this->helper->sfUpdateOrderNameCol($order_id, true);
+
+ $this->expected['shipping'] = array(array('shipping_time' => '午後')); // 変更されていない
+ $this->expected['order'] = array(array('payment_method' => '支払方法1001')); // 変更されていない
+ $this->expected['order_temp'] = array(array('payment_method' => '支払方法1002'));
+
+ $this->actual['shipping'] = $this->objQuery->select(
+ 'shipping_time', 'dtb_shipping', 'order_id = ?', array($order_id)
+ );
+ $this->actual['order'] = $this->objQuery->select(
+ 'payment_method', 'dtb_order', 'order_id = ?', array($order_id)
+ );
+ $this->actual['order_temp'] = $this->objQuery->select(
+ 'payment_method', 'dtb_order_temp', 'order_temp_id = ?', array($order_id)
+ );
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderNameColTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
変更: branches/version-2_12-dev/tests/class/test/util/User_Utils.php
===================================================================
--- branches/version-2_12-dev/tests/class/test/util/User_Utils.php 2012-12-21 06:56:41 UTC (rev 22157)
+++ branches/version-2_12-dev/tests/class/test/util/User_Utils.php 2012-12-25 13:47:45 UTC (rev 22158)
@@ -31,6 +31,7 @@
$customer = array_merge(self::getDefaultCustomer(), $customer);
$_SESSION['customer']['customer_id'] = $customer['customer_id'];
$_SESSION['customer']['email'] = $customer['email'];
+// $objQuery->delete('dtb_customer', 'customer_id = ?', array($customer['customer_id']));
$objQuery->insert('dtb_customer', $customer);
}
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php 2012-12-25 13:47:45 UTC (rev 22158)
@@ -0,0 +1,101 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfArrKeyValue()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfArrKeyValueTest extends Common_TestCase {
+
+ var $arrList;
+ var $keyname;
+ var $valuename;
+
+ protected function setUp() {
+ // parent::setUp();
+
+ $this->arrList = array(
+ array('testkey' => '1011', 'testvalue' => '2001', 'key' => '3001'),
+ array('testkey' => '2022', 'testvalue' => '2002', 'key' => '3002'),
+ array('testkey' => '3033', 'testvalue' => '2003', 'key' => '3003'),
+ array('testkey' => '4044', 'testvalue' => '2004', 'key' => '3004')
+ );
+ $this->keyname = 'testkey';
+ $this->valuename = 'testvalue';
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfArrKeyValue_最大長が配列より短い場合_最大長でカットされる() {
+ $len_max = 3;
+
+ $this->expected = array(
+ '1011' => '2001',
+ '2022' => '2002',
+ '3033' => '2003'
+ );
+ $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max);
+
+ $this->verify();
+ }
+
+ public function testSfArrKeyValue_最大長が指定されていない場合_全要素が出力される() {
+ $this->expected = array(
+ '1011' => '2001',
+ '2022' => '2002',
+ '3033' => '2003',
+ '4044' => '2004'
+ );
+ $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max);
+
+ $this->verify();
+ }
+
+ public function testSfArrKeyValue_キーサイズが短い場合_キーサイズでカットされる() {
+ $len_max = 5;
+ $keysize = 1;
+
+ $this->expected = array(
+ '1...' => '2001',
+ '2...' => '2002',
+ '3...' => '2003',
+ '4...' => '2004'
+ );
+ $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max, $keysize);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
Svn-src-all メーリングリストの案内