Index: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php	(revision 22193)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php	(revision 22204)
@@ -44,4 +44,6 @@
 
   /////////////////////////////////////////
+  // TODO 環境により出力形式が異なるため、テスト不可(デバッグ用なので、テストしなくてもよさそう)
+  /**
   public function testSfPrintR__指定したオブジェクトの情報が出力される() {
     $output = '<div style="font-size: 12px;color: #00FF00;">' . "\n"
@@ -58,5 +60,5 @@
     SC_Utils::sfPrintR(array('test'=>'TEST'));
   }
-
+  */
   //////////////////////////////////////////
 
Index: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php	(revision 22204)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php	(revision 22204)
@@ -0,0 +1,198 @@
+<?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::registerOrder()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_registerOrderTest extends SC_Helper_Purchase_TestBase {
+
+  private $helper;
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpOrder();
+    $this->helper = new SC_Helper_Purchase_registerOrderMock();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testRegisterOrder_既に受注IDが存在する場合_情報が更新される() {
+    $order_id = '1001';
+    $arrParams = array(
+      'status' => '1',
+      'add_point' => 10,
+      'use_point' => 20,
+      'order_name01' => '受注情報01_更新'
+    );
+
+    $this->helper->registerOrder($order_id, $arrParams);
+
+    $this->expected = array(
+      'sfUpdateOrderStatus' => array(
+        'order_id' => '1001',
+        'status' => '1',
+        'add_point' => 10,
+        'use_point' => 20
+      ),
+      'sfUpdateOrderNameCol' => '1001',
+      'count' => '2',
+      'content' => array(
+        'order_id' => '1001',
+        'customer_id' => '1001',
+        'status' => '1',
+        'add_point' => '10',
+        'use_point' => '20',
+        'order_name01' => '受注情報01_更新'
+      )
+    );
+    $this->actual = $_SESSION['testResult'];
+    $this->actual['count'] = $this->objQuery->count('dtb_order');
+    $result = $this->objQuery->select(
+      'order_id, customer_id, status, order_name01, add_point, use_point',
+      'dtb_order',
+      'order_id = ?',
+      array($order_id)
+    );
+    $this->actual['content'] = $result[0];
+
+    $this->verify();
+  }
+
+  public function testRegisterOrder_存在しない受注IDを指定した場合_新規に登録される() {
+    $order_id = '1003';
+    $arrParams = array(
+      'customer_id' => '1003',
+      'status' => '2',
+      'add_point' => 100,
+      'use_point' => 200,
+      'order_name01' => '受注情報03'
+    );
+
+    $this->helper->registerOrder($order_id, $arrParams);
+
+    $this->expected = array(
+      'sfUpdateOrderStatus' => array(
+        'order_id' => '1003',
+        'status' => '2',
+        'add_point' => 100,
+        'use_point' => 200
+      ),
+      'sfUpdateOrderNameCol' => '1003',
+      'count' => '3',
+      'content' => array(
+        'order_id' => '1003',
+        'customer_id' => '1003',
+        'status' => null,         // ここではsfUpdateOrderStatusをモックにしているので更新されない
+        'add_point' => '100',
+        'use_point' => '200',
+        'order_name01' => '受注情報03'
+      )
+    );
+    $this->actual = $_SESSION['testResult'];
+    $this->actual['count'] = $this->objQuery->count('dtb_order');
+    $result = $this->objQuery->select(
+      'order_id, customer_id, status, order_name01, add_point, use_point',
+      'dtb_order',
+      'order_id = ?',
+      array($order_id)
+    );
+    $this->actual['content'] = $result[0];
+
+    $this->verify();
+  }
+
+  public function testRegisterOrder_受注IDが未指定の場合_新たにIDが発行される() {
+    $order_id = '';
+    $arrParams = array( // 顧客IDも未指定
+      'status' => '2',
+      'add_point' => 100,
+      'use_point' => 200,
+      'order_name01' => '受注情報03'
+    );
+
+    // SEQの値を取得
+    $new_order_id = $this->helper->getNextOrderID() + 1;
+
+    $this->helper->registerOrder($order_id, $arrParams);
+
+    $this->expected = array(
+      'sfUpdateOrderStatus' => array(
+        'order_id' => $new_order_id,
+        'status' => '2',
+        'add_point' => 100,
+        'use_point' => 200
+      ),
+      'sfUpdateOrderNameCol' => $new_order_id,
+      'count' => '3',
+      'content' => array(
+        'order_id' => $new_order_id,
+        'customer_id' => '0',
+        'status' => null,         // ここではsfUpdateOrderStatusをモックにしているので更新されない
+        'add_point' => '100',
+        'use_point' => '200',
+        'order_name01' => '受注情報03'
+      )
+    );
+    $this->actual = $_SESSION['testResult'];
+    $this->actual['count'] = $this->objQuery->count('dtb_order');
+    $result = $this->objQuery->select(
+      'order_id, customer_id, status, order_name01, add_point, use_point',
+      'dtb_order',
+      'order_id = ?',
+      array($new_order_id)
+    );
+    $this->actual['content'] = $result[0];
+
+    $this->verify();
+
+  }
+
+  //////////////////////////////////////////
+
+}
+
+class SC_Helper_Purchase_registerOrderMock extends SC_Helper_Purchase {
+  function sfUpdateOrderStatus($order_id, $status, $add_point, $use_point, $values) {
+    $_SESSION['testResult']['sfUpdateOrderStatus'] = array(
+      'order_id' => $order_id,
+      'status' => $status,
+      'add_point' => $add_point,
+      'use_point' => $use_point,
+    );
+  }
+
+  function sfUpdateOrderNameCol($order_id) {
+   $_SESSION['testResult']['sfUpdateOrderNameCol'] = $order_id;
+  }
+}
+
Index: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php	(revision 22202)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php	(revision 22204)
@@ -38,5 +38,5 @@
     parent::setUp();
     $this->setUpOrderTemp();
-    $this->helper = new SC_Helper_Purchase_Mock();
+    $this->helper = new SC_Helper_Purchase_saveOrderTempMock();
   }
 
@@ -135,5 +135,5 @@
 }
 
-class SC_Helper_Purchase_Mock extends SC_Helper_Purchase {
+class SC_Helper_Purchase_saveOrderTempMock extends SC_Helper_Purchase {
   function copyFromCustomer($sqlval, $objCustomer) {
     echo('COPY_FROM_CUSTOMER');
Index: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php	(revision 22204)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php	(revision 22204)
@@ -0,0 +1,91 @@
+<?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::setShipmentItemTempForSole()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_setShipmentItemTempForSoleTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+    $_SESSION['testResult'] = null;
+  }
+
+  /////////////////////////////////////////
+  public function testSetShipmentItemTempForSole__いったん配送情報がクリアされたあと改めて指定のものが設定される() {
+    $helper = new SC_Helper_Purchase_setShipmentItemTempForSoleMock();
+    $cartSession = new SC_CartSession_setShipmentItemTempForSoleMock();
+    $shipping_id = '1001';
+
+    $helper->setShipmentItemTempForSole($cartSession, $shipping_id);
+
+    $this->expected = array(
+      'clearShipmentItemTemp' => TRUE,
+      'shipmentItemTemp' => array(
+        array('shipping_id'=>'1001', 'id'=>'1', 'quantity'=>'10'),
+        array('shipping_id'=>'1001', 'id'=>'2', 'quantity'=>'5')
+      )
+    );
+    $this->actual = $_SESSION['testResult'];
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+
+class SC_Helper_Purchase_setShipmentItemTempForSoleMock extends SC_Helper_Purchase {
+  function clearShipmentItemTemp() {
+    $_SESSION['testResult']['clearShipmentItemTemp'] = TRUE;
+  }
+
+  function setShipmentItemTemp($shipping_id, $id, $quantity) {
+    $_SESSION['testResult']['shipmentItemTemp'][] = 
+      array('shipping_id' => $shipping_id, 'id' => $id, 'quantity' => $quantity);
+  }
+}
+
+class SC_CartSession_setShipmentItemTempForSoleMock extends SC_CartSession {
+  function getCartList($key) {
+    return array(
+      array('id'=>'1', 'quantity'=>'10'),
+      array('id'=>'2', 'quantity'=>'5'),
+      array('id'=>'3', 'quantity'=>'0')
+    );
+  }
+}
+
+
Index: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php	(revision 22204)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php	(revision 22204)
@@ -0,0 +1,180 @@
+<?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::completeOrder()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_completeOrderTest extends SC_Helper_Purchase_TestBase {
+
+  private $helper;
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpOrderTemp(); // order_temp_id = '1001'
+    $this->setUpShipping();
+    $this->setUpCustomer();
+
+    $_SESSION['cartKey'] = '1';
+    $_SESSION['site'] = array(
+      'pre_page' => 'pre',
+      'now_page' => 'now',
+      'regist_success' => TRUE,
+      'uniqid' => '1001'
+    );
+
+    $this->helper = new SC_Helper_Purchase_completeOrderMock();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  // 適切なfunctionが呼ばれていることのみ確認
+  public function testCompleteOrder_顧客IDが指定されている場合_購入日が更新される() {
+    $_SESSION['customer']['customer_id'] = '1002'; // 顧客ID
+    $this->helper->completeOrder(ORDER_DELIV);
+
+    $this->expected = array(
+      'verifyChangeCart' => array(
+        'uniqId' => '1001'
+      ),
+      'getOrderTemp' => array(
+        'uniqId' => '1001'
+      ),
+      'registerOrderComplete' => array(
+        'order_temp_id' => '1001',
+        'status' => ORDER_DELIV,
+        'cartKey' => '1'
+      ),
+      'registerShipmentItem' => array(
+        array(
+          'order_id' => '1001',
+          'shipping_id' => '00001',
+          'shipment_item' => '商品1'
+        )
+      ),
+      'registerShipping' => array(
+        'order_id' => '1001'
+      ),
+      'cleanupSession' => array(
+        'order_id' => '1001',
+        'cartKey' => '1'
+      )
+    );
+    $this->actual = $_SESSION['testResult'];
+    $this->verify('適切なfunctionが呼ばれている');
+    $last_buy_date = $this->objQuery->get('last_buy_date', 'dtb_customer', 'customer_id = ?', '1002');
+    $this->assertNotNull($last_buy_date, '最終購入日');
+  }
+
+  public function testCompleteOrder_顧客IDが指定されていない場合_特にエラーなく修了できる() {
+    $this->helper->completeOrder(); // デフォルトのステータス(NEW)
+
+    $this->expected = array(
+      'verifyChangeCart' => array(
+        'uniqId' => '1001'
+      ),
+      'getOrderTemp' => array(
+        'uniqId' => '1001'
+      ),
+      'registerOrderComplete' => array(
+        'order_temp_id' => '1001',
+        'status' => ORDER_NEW,
+        'cartKey' => '1'
+      ),
+      'registerShipmentItem' => array(
+        array(
+          'order_id' => '1001',
+          'shipping_id' => '00001',
+          'shipment_item' => '商品1'
+        )
+      ),
+      'registerShipping' => array(
+        'order_id' => '1001'
+      ),
+      'cleanupSession' => array(
+        'order_id' => '1001',
+        'cartKey' => '1'
+      )
+    );
+    $this->actual = $_SESSION['testResult'];
+    $this->verify('適切なfunctionが呼ばれている');
+  }
+
+  //////////////////////////////////////////
+
+}
+
+class SC_Helper_Purchase_completeOrderMock extends SC_Helper_Purchase{
+
+  function verifyChangeCart($uniqId, $objCartSession){
+    $_SESSION['testResult']['verifyChangeCart'] = array('uniqId'=>$uniqId);
+  }
+
+  function getOrderTemp($uniqId) {
+    $_SESSION['testResult']['getOrderTemp'] = array('uniqId'=>$uniqId);
+    return parent::getOrderTemp($uniqId);
+  }
+
+  function registerOrderComplete($orderTemp, $objCartSession, $cartKey) {
+    $_SESSION['testResult']['registerOrderComplete'] = array(
+      'order_temp_id' => $orderTemp['order_temp_id'],
+      'status' => $orderTemp['status'],
+      'cartKey' => $cartKey
+    );
+    return parent::registerOrderComplete($orderTemp, $objCartSession, $cartKey);
+  }
+
+  function registerShipmentItem($order_id, $shipping_id, $shipment_item) {
+    $_SESSION['testResult']['registerShipmentItem'][] = array(
+      'order_id' => $order_id,
+      'shipping_id' => $shipping_id,
+      'shipment_item' => $shipment_item
+    );
+  }
+
+  function registerShipping($order_id, $shipping_temp) {
+    $_SESSION['testResult']['registerShipping'] = array(
+      'order_id' => $order_id
+    );
+  }
+
+  function cleanupSession($order_id, $objCartSesion, $objCustomer, $cartKey) {
+    $_SESSION['testResult']['cleanupSession'] = array(
+      'order_id' => $order_id,
+      'cartKey' => $cartKey
+    );
+  }
+
+}
+
+?>
+
Index: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php	(revision 22204)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php	(revision 22204)
@@ -0,0 +1,89 @@
+<?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::setShipmentItemTemp()のテストクラス.
+ * 【注意】dtb_baseinfoはインストール時に入るデータをそのまま使用
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_setShipmentItemTempTest extends SC_Helper_Purchase_TestBase {
+  private $helper;
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpProductClass();
+    $this->setUpProducts();
+
+    $_SESSION['shipping']['1001']['shipment_item'] = array(
+      '1001' => array('productsClass' => array('price02' => 9000))
+    );
+    $this->helper = new SC_Helper_Purchase();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSetShipmentItemTemp_製品情報が既に存在する場合_存在する情報が価格に反映される() {
+    $this->helper->setShipmentItemTemp('1001', '1001', 10);
+
+    $this->expected = array(
+      'shipping_id' => '1001',
+      'product_class_id' => '1001',
+      'quantity' => 10,
+      'price' => 9000,
+      'total_inctax' => 94500.0,
+      'productsClass' => array('price02' => 9000)
+    );
+    $this->actual = $_SESSION['shipping']['1001']['shipment_item']['1001'];
+
+    $this->verify();
+  }
+
+  public function testSetShipmentItemTemp_製品情報が存在しない場合_DBから取得した値が反映される() {
+    $this->helper->setShipmentItemTemp('1001', '1002', 10);
+
+    $this->expected = array(
+      'shipping_id' => '1001',
+      'product_class_id' => '1002',
+      'quantity' => 10,
+      'price' => '2500',
+      'total_inctax' => 26250.0
+    );
+    $result = $_SESSION['shipping']['1001']['shipment_item']['1002'];
+    unset($result['productsClass']);
+    $this->actual = $result;
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+
Index: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php	(revision 22204)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php	(revision 22204)
@@ -0,0 +1,168 @@
+<?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::registerOrderComplete()のテストクラス.
+ * TODO 在庫の減少処理はエラー表示⇒exit呼び出しとなるためテスト不可.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+
+class SC_Helper_Purchase_registerOrderCompleteTest extends SC_Helper_Purchase_TestBase {
+  private $helper;
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpOrderTemp();
+    $this->helper = new SC_Helper_Purchase_registerOrderCompleteMock();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testRegisterOrderComplete_不要な変数が含まれている場合_登録前に除外される() {
+    // 引数の準備
+    $orderParams = array(
+      'order_id' => '1001',
+      'status' => ORDER_PAY_WAIT,
+      'mail_maga_flg' => '1',
+      'order_tax_rate' => '5',
+      'order_tax_rule' => '1'
+    );
+    $cartSession = new SC_CartSession_registerOrderCompleteMock();
+    $_SESSION['site']['uniqid'] = '1001';
+
+    $this->helper->registerOrderComplete($orderParams, $cartSession, '1');
+ 
+    $this->expected = array(
+      'registerOrder' => array(
+        'order_id' => '1001',
+        'status' => ORDER_PAY_WAIT,
+        'mailmaga_flg' => null
+      ),
+      'registerOrderDetail' => array(
+        'order_id' => '1001',
+        'params' => array(
+          array(
+            'order_id' => '1001',
+            'product_id' => '1002',
+            'product_class_id' => '1002',
+            'product_name' => '製品02',
+            'product_code' => 'cd1002',
+            'classcategory_name1' => 'cat01',
+            'classcategory_name2' => 'cat02',
+            'point_rate' => '5',
+            'price' => '1000',
+            'quantity' => '10',
+            'tax_rate' => '5',
+            'tax_rule' => '1'
+          )
+        )
+      ),
+      'del_flg' => '1'
+    );
+
+    $this->actual = $_SESSION['testResult'];
+    $this->actual['del_flg'] = $this->objQuery->get('del_flg', 'dtb_order_temp', 'order_temp_id = ?', '1001');
+    $this->verify();
+  }
+
+  public function testRegisterOrderComplete_ステータスの指定がない場合_新規受付扱いとなる() {
+    // 引数の準備
+    $orderParams = array(
+      'order_id' => '1001',
+    //  'status' => ORDER_PAY_WAIT,
+      'order_tax_rate' => '5',
+      'order_tax_rule' => '1'
+    );
+    $cartSession = new SC_CartSession_registerOrderCompleteMock();
+    $_SESSION['site']['uniqid'] = '1001';
+
+    $this->helper->registerOrderComplete($orderParams, $cartSession, '1');
+ 
+    // 上の条件と重複する部分は確認を省略
+    $this->expected = array(
+      'registerOrder' => array(
+        'order_id' => '1001',
+        'status' => ORDER_NEW,
+        'mailmaga_flg' => null
+      )
+    );
+
+    $this->actual['registerOrder'] = $_SESSION['testResult']['registerOrder'];
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+
+class SC_Helper_Purchase_registerOrderCompleteMock extends SC_Helper_Purchase {
+
+  function registerOrder($order_id, $params) {
+    $_SESSION['testResult']['registerOrder'] = array(
+      'order_id' => $order_id,
+      'status' => $params['status'],
+      'mailmaga_flg' => $params['mailmaga_flg']
+    );
+  }
+
+  function registerOrderDetail($order_id, $params) {
+    $_SESSION['testResult']['registerOrderDetail'] = array(
+      'order_id' => $order_id,
+      'params' => $params
+    );
+  }
+
+  function setUniqId() {}
+}
+
+class SC_CartSession_registerOrderCompleteMock extends SC_CartSession {
+
+  // カートの内容を取得
+  function getCartList($cartKey) {
+    return array(
+      array(
+        'productsClass' => array(
+          'product_id' => '1002',
+          'product_class_id' => '1002',
+          'name' => '製品02',
+          'product_code' => 'cd1002',
+          'classcategory_name1' => 'cat01',
+          'classcategory_name2' => 'cat02'
+        ),
+        'point_rate' => '5',
+        'price' => '1000',
+        'quantity' => '10'
+      )
+    );
+  }
+}
+?>
+
Index: 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	(revision 22203)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php	(revision 22204)
@@ -47,5 +47,5 @@
   protected function setUpShipping($shipping) {
     if (!$shipping) {
-      $shipping = getSingleShipping(); 
+      $shipping = $this->getSingleShipping(); 
     }
 
@@ -85,5 +85,5 @@
     $shippings = array(
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'shipping_id' => '1',
         'order_id' => '1',
@@ -92,5 +92,5 @@
       ),
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'shipping_id' => '2',
         'order_id' => '2',
@@ -99,5 +99,5 @@
       ),
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'shipping_id' => '1002',
         'order_id' => '1002',
@@ -147,5 +147,5 @@
       $product_class = array(
         array(
-          'update_date' => 'CURRENT_TIMESTAMP',
+          'update_date' => '2000-01-01 00:00:00',
           'product_class_id' => '1001',
           'product_id' => '1001',
@@ -160,5 +160,5 @@
         ),
         array(
-          'update_date' => 'CURRENT_TIMESTAMP',
+          'update_date' => '2000-01-01 00:00:00',
           'product_class_id' => '1002',
           'product_id' => '1002',
@@ -184,5 +184,5 @@
     $class_category = array(
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'classcategory_id' => '1001',
         'class_id' => '1',
@@ -191,5 +191,5 @@
       ),
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'classcategory_id' => '1002',
         'class_id' => '1',
@@ -211,5 +211,5 @@
    $products = array(
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'product_id' => '1001',
        'name' => '製品名1001',
@@ -219,5 +219,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'product_id' => '1002',
        'name' => '製品名1002',
@@ -299,5 +299,5 @@
        'creator_id' => '1',
        'del_flg' => '1',
-       'update_date' => 'CURRENT_TIMESTAMP'
+       'update_date' => '2000-01-01 00:00:00'
      ),
      array(
@@ -307,5 +307,5 @@
        'creator_id' => '1',
        'rank' => '2',
-       'update_date' => 'CURRENT_TIMESTAMP'
+       'update_date' => '2000-01-01 00:00:00'
      ),
      array(
@@ -315,5 +315,5 @@
        'creator_id' => '1',
        'rank' => '3',
-       'update_date' => 'CURRENT_TIMESTAMP'
+       'update_date' => '2000-01-01 00:00:00'
      ),
      array( // 商品種別違い
@@ -323,5 +323,5 @@
        'creator_id' => '1',
        'rank' => '4',
-       'update_date' => 'CURRENT_TIMESTAMP'
+       'update_date' => '2000-01-01 00:00:00'
      ),
    );
@@ -367,5 +367,5 @@
    $payment = array(
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '1001',
        'creator_id' => '1',
@@ -373,5 +373,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '1002',
        'creator_id' => '1',
@@ -380,5 +380,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '1003',
        'creator_id' => '1',
@@ -386,5 +386,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '3001',
        'creator_id' => '1',
@@ -393,5 +393,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '3002',
        'creator_id' => '1',
@@ -399,5 +399,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '3003',
        'creator_id' => '1',
@@ -406,5 +406,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '3004',
        'creator_id' => '1',
@@ -413,5 +413,5 @@
      ),
      array(
-       'update_date' => 'CURRENT_TIMESTAMP',
+       'update_date' => '2000-01-01 00:00:00',
        'payment_id' => '3005',
        'creator_id' => '1',
@@ -434,19 +434,24 @@
     $order = array(
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'order_id' => '1001',
         'customer_id' => '1001',
         'order_name01' => '受注情報01',
         'status' => '3',
-        'payment_date' => '2032-12-31 01:20:30' // 日付が変わっても良いように、遠い未来に設定
+        'payment_date' => '2032-12-31 01:20:30', // 日付が変わっても良いように、遠い未来に設定
+        'use_point' => '10',
+        'add_point' => '20'
       ),
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'order_id' => '1002',
         'customer_id' => '1002',
         'order_name01' => '受注情報02',
+        'status' => '5',
         'payment_id' => '1002',
         'payment_method' => '支払方法1001',
-        'deliv_id' => '1002'
+        'deliv_id' => '1002',
+        'use_point' => '10',
+        'add_point' => '20'
       )
     );
@@ -464,11 +469,12 @@
     $order = array(
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'order_temp_id' => '1001',
         'customer_id' => '1001',
-        'order_name01' => '受注情報01'
+        'order_name01' => '受注情報01',
+        'order_id' => '1001'
       ),
       array(
-        'update_date' => 'CURRENT_TIMESTAMP',
+        'update_date' => '2000-01-01 00:00:00',
         'order_temp_id' => '1002',
         'customer_id' => '1002',
@@ -535,4 +541,39 @@
  }
 
+ /**
+  * DBに顧客情報を設定します。
+  */
+ protected function setUpCustomer() {
+   $customer = array(
+     array(
+       'customer_id' => '1001',
+       'name01' => '苗字',
+       'name02' => '名前',
+       'kana01' => 'みょうじ',
+       'kana02' => 'なまえ',
+       'email' => 'test@example.com',
+       'secret_key' => 'hoge',
+       'point' => '100',
+       'update_date' => '2000-01-01 00:00:00'
+     ),
+     array(
+       'customer_id' => '1002',
+       'name01' => '苗字2',
+       'name02' => '名前2',
+       'kana01' => 'みょうじ2',
+       'kana02' => 'なまえ2',
+       'email' => 'test2@example.com',
+       'secret_key' => 'hoge2',
+       'point' => '200',
+       'update_date' => '2000-01-01 00:00:00'
+     )
+   );
+
+   $this->objQuery->delete('dtb_customer');
+   foreach ($customer as $item) {
+     $this->objQuery->insert('dtb_customer', $item);
+   }
+ }
+
 }
 
Index: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php	(revision 22204)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php	(revision 22204)
@@ -0,0 +1,366 @@
+<?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::sfUpdateOrderStatus()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_sfUpdateOrderStatusTest extends SC_Helper_Purchase_TestBase {
+
+  private $helper;
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpOrder();
+    $this->setUpCustomer();
+    $this->helper = new SC_Helper_Purchase_sfUpdateOrderStatusMock();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  // オプションの引数：対応状況、使用ポイント、加算ポイント
+  public function testSfUpdateOrderStatus_オプションの引数が未指定の場合_DBの値が引き継がれる() {
+    $order_id = '1001';
+    $old_update_date = $this->objQuery->get('update_date', 'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->usePoint = false;
+    $this->helper->addPoint = false;
+    $this->helper->sfUpdateOrderStatus($order_id); // 引数は最低限だけ指定
+
+    $this->expected = array(
+      'order' => array(
+        'status' => '3',
+        'add_point' => '20',
+        'use_point' => '10'
+      ),
+      'customer' => array(
+        'point' => '100' 
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', '1001'));
+
+    $this->verify();
+
+    $update_date = $this->objQuery->get('update_date', 'dtb_order', 'order_id = ?', array($order_id));
+    $this->assertTrue($update_date > $old_udpate_date, '受注情報が更新されている');
+  }
+
+  // TODO 定数を変更できないためテスト不可
+  /**
+  public function testSfUpdateOrderStatus_ポイント使用しない設定の場合_ポイントに関する処理が行われない() {
+
+
+    $this->verify();
+  }
+  */
+
+  public function testSfUpdateOrderStatus_対応状況が発送済みに変更された場合_発送日が更新される() {
+    $order_id = '1001';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->usePoint = false;
+    $this->helper->addPoint = false;
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_DELIV, 50, 45);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_DELIV,
+        'add_point' => '50',  // 引数の設定どおりになる
+        'use_point' => '45' // 引数の設定どおりになる
+      ),
+      'customer' => array(
+        'point' => '100' // ポイントを使わない 
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', '1001'));
+
+    $this->verify();
+
+    $new_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+    $this->assertUpdate($new_dates, $old_dates, 'update_date', '受注情報');  
+    $this->assertUpdate($new_dates, $old_dates, 'commit_date', '発送日');  
+    $this->assertUpdate($new_dates, $old_dates, 'payment_date', '入金日', false);  
+  }
+
+  public function testSfUpdateOrderStatus_対応状況が入金済みに変更された場合_入金日が更新される() {
+    $order_id = '1002';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->usePoint = false;
+    $this->helper->addPoint = false;
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_PRE_END, 50, 45);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_PRE_END,
+        'add_point' => '50',  // 引数の設定どおりになる
+        'use_point' => '45' // 引数の設定どおりになる
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+
+    $this->verify();
+
+    $new_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+    $this->assertUpdate($new_dates, $old_dates, 'update_date', '受注情報');  
+    $this->assertUpdate($new_dates, $old_dates, 'commit_date', '発送日', false);  
+    $this->assertUpdate($new_dates, $old_dates, 'payment_date', '入金日');  
+  }
+
+  public function testSfUpdateOrderStatus_変更前の対応状況が利用対象の場合_変更前の使用ポイントを戻す() {
+    $order_id = '1002';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->addPoint = false; // 加算は強制的にfalseにしておく
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_CANCEL, 0, 45);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_CANCEL,
+        'add_point' => '0',  // 引数の設定どおりになる
+        'use_point' => '45' // 引数の設定どおりになる
+      ),
+      'customer' => array(
+        'point' => '210' // 元々200pt+10pt戻す
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', array('1002')));
+
+    $this->verify();
+  }
+
+  public function testSfUpdateOrderStatus_変更後の対応状況が利用対象の場合_変更後の使用ポイントを引く() {
+    $order_id = '1001';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_NEW, 50, 45);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_NEW,
+        'add_point' => '50',  // 引数の設定どおりになる
+        'use_point' => '45' // 引数の設定どおりになる
+      ),
+      'customer' => array(
+        'point' => '55' // 元々100pt→45pt引く
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', array('1001')));
+
+    $this->verify();
+  }
+
+  public function testSfUpdateOrderStatus_変更前の対応状況が加算対象の場合_変更前の加算ポイントを戻す() {
+    $order_id = '1002';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->usePoint = false; // 使用対象は強制的にfalseにしておく
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_CANCEL, 50, 45);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_CANCEL,
+        'add_point' => '50',  // 引数の設定どおりになる
+        'use_point' => '45' // 引数の設定どおりになる
+      ),
+      'customer' => array(
+        'point' => '180' // 元々200pt→20pt引く
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', array('1002')));
+
+    $this->verify();
+  }
+
+  public function testSfUpdateOrderStatus_変更後の対応状況が加算対象の場合_変更後の加算ポイントを足す() {
+    $order_id = '1001';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_DELIV, 50, 0);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_DELIV,
+        'add_point' => '50',  // 引数の設定どおりになる
+        'use_point' => '0' // 引数の設定どおりになる
+      ),
+      'customer' => array(
+        'point' => '150' // 元々100pt→50pt足す
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', array('1001')));
+
+    $this->verify();
+  }
+
+  public function testSfUpdateOrderStatus_加算ポイントがプラスの場合_会員テーブルが更新される() {
+    $order_id = '1001';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->usePoint = true;
+    $this->helper->addPoint = true;
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_PRE_END, 40, 25);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_PRE_END,
+        'add_point' => '40',  // 引数の設定どおりになる
+        'use_point' => '25' // 引数の設定どおりになる
+      ),
+      'customer' => array(
+        'point' => '105' // 変更前の状態で-10pt,変更後の状態で+15pt 
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', '1001'));
+
+    $this->verify();
+  }
+
+  public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りている場合_会員テーブルが更新される() {
+    $order_id = '1001';
+    $old_dates = $this->objQuery->select(
+      'update_date, commit_date, payment_date', 
+      'dtb_order', 'order_id = ?', array($order_id));
+
+    $this->helper->usePoint = true;
+    $this->helper->addPoint = true;
+    $this->helper->sfUpdateOrderStatus($order_id, ORDER_PRE_END, 0, 50);
+
+    $this->expected = array(
+      'order' => array(
+        'status' => ORDER_PRE_END,
+        'add_point' => '0',  // 引数の設定どおりになる
+        'use_point' => '50' // 引数の設定どおりになる
+      ),
+      'customer' => array(
+        'point' => '40' // 変更前の状態で-10pt,変更後の状態で-50pt 
+      )
+    );
+    $this->actual['order'] = array_shift($this->objQuery->select(
+      'status, use_point, add_point',
+      'dtb_order', 'order_id = ?', array($order_id)));
+    $this->actual['customer'] = array_shift($this->objQuery->select(
+      'point', 'dtb_customer', 'customer_id = ?', '1001'));
+
+    $this->verify();
+  }
+
+  // TODO ロールバックされる場合はexitするためテスト不可.
+  /**
+  public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りていない場合_会員テーブルがロールバックされエラーとなる() {
+  }
+  */
+
+  //////////////////////////////////////////
+
+  function assertUpdate($new_dates, $old_dates, $key, $message, $is_update = true) {
+    $new_date = $new_dates[0][$key];
+    $old_date = $old_dates[0][$key];
+    if (empty($new_date)) $new_date = '2000-01-01 00:00:00';
+    if (empty($old_date)) $old_date = '2000-01-01 00:00:00';
+
+    if ($is_update) {
+      $this->assertTrue($new_date > $old_date, $message . 'が更新されている');
+    } else {
+      $this->assertEquals($new_date, $old_date, $message . 'が更新されていない');
+    }
+  }
+}
+
+class SC_Helper_Purchase_sfUpdateOrderStatusMock extends SC_Helper_Purchase {
+
+  var $usePoint;
+  var $addPoint;
+
+  function isUsePoint($status) {
+    if (is_null($this->usePoint)) {
+      return parent::isUsePoint($status);
+    }
+    return $this->usePoint;
+  }
+
+  function isAddPoint($status) {
+    if (is_null($this->addPoint)) {
+      return parent::isAddPoint($status);
+    }
+    return $this->addPoint;
+  }
+}
+
