[Svn-src-all:3240] [version-2_12-dev 22141] #1978 SC_Helper_Purchaseの単体テスト一部を追加

shift_hiroko.tamagawa admin @ mail.ec-cube.net
2012年 12月 16日 (日) 22:58:27 JST


Subversion committed to /home/svn/open 22141
http://svn.ec-cube.net/open_trac/changeset/22141
┌────────────────────────────┐
│更新者 :  shift_hiroko.tamagawa                        │
│更新日時:  2012-12-16 22:58:26 +0900 (日, 16 12月 2012)│
└────────────────────────────┘

Log:
--------------------------------------------------------
#1978 SC_Helper_Purchaseの単体テスト一部を追加

Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTimeTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPaymentsIdTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPriceTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php

追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -0,0 +1,165 @@
+<?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::copyFromCustomer()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_copyFromCustomerTest extends SC_Helper_Purchase_TestBase {
+
+  var $customer;
+  var $customer_array;
+
+  protected function setUp() {
+    parent::setUp();
+    $this->customer = new SC_Customer();
+    $this->customer->setValue('customer_id', '1001');
+    $this->customer->setValue('name01', '姓01');
+    $this->customer->setValue('name02', '名01');
+    $this->customer->setValue('kana01', 'セイ01');
+    $this->customer->setValue('kana02', 'メイ01');
+    $this->customer->setValue('sex', '1');
+    $this->customer->setValue('zip01', '123');
+    $this->customer->setValue('zip02', '4567');
+    $this->customer->setValue('pref', '東京都');
+    $this->customer->setValue('addr01', 'abc市');
+    $this->customer->setValue('addr02', 'def町');
+    $this->customer->setValue('tel01', '01');
+    $this->customer->setValue('tel02', '234');
+    $this->customer->setValue('tel03', '5678');
+    $this->customer->setValue('fax01', '02');
+    $this->customer->setValue('fax02', '345');
+    $this->customer->setValue('fax03', '6789');
+    $this->customer->setValue('job', '会社員');
+    $this->customer->setValue('birth', '2012-01-01');
+    $this->customer->setValue('email', 'test @ example.com');
+
+    $this->customer_array = array('customer_id' => '1001', 'email' => 'test @ example.com');
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testCopyFromCustomer_ログインしていない場合_何もしない() {
+    $dest = array();
+    User_Utils::setLoginState(FALSE, $this->customer_array, $this->objQuery);
+
+    $this->expected = array();
+    $helper = new SC_Helper_Purchase();
+    $helper->copyFromCustomer($dest, $this->customer);
+    $this->actual = $dest;
+
+    $this->verify();
+  }
+
+  public function testCopyFromCustomer_モバイルの場合_モバイルのメールアドレスを設定する() {
+    $dest = array();
+    User_Utils::setLoginState(TRUE, $this->customer_array, $this->objQuery);
+    User_Utils::setDeviceType(DEVICE_TYPE_MOBILE);
+    $this->customer->setValue('email_mobile', 'mobile @ example.com');
+
+    $this->expected = array(
+      'order_name01' => '姓01',
+      'order_name02' => '名01',
+      'order_kana01' => 'セイ01',
+      'order_kana02' => 'メイ01',
+      'order_sex' => '1',
+      'order_zip01' => '123',
+      'order_zip02' => '4567',
+      'order_pref' => '東京都',
+      'order_addr01' => 'abc市',
+      'order_addr02' => 'def町',
+      'order_tel01' => '01',
+      'order_tel02' => '234',
+      'order_tel03' => '5678',
+      'order_fax01' => '02',
+      'order_fax02' => '345',
+      'order_fax03' => '6789',
+      'order_job' => '会社員',
+      'order_birth' => '2012-01-01',
+      'order_email' => 'mobile @ example.com',
+      'customer_id' => '1001',
+      'update_date' => 'CURRENT_TIMESTAMP'
+    );
+    $helper = new SC_Helper_Purchase();
+    $helper->copyFromCustomer($dest, $this->customer);
+    $this->actual = $dest;
+
+    $this->verify();
+  }
+
+  public function testCopyFromCustomer_モバイルかつモバイルのメールアドレスがない場合_通常のメールアドレスを設定する() {
+    $dest = array();
+    $prefix = 'order';
+    // キーを絞る
+    $keys = array('name01', 'email');
+    User_Utils::setLoginState(TRUE, $this->customer_array, $this->objQuery);
+    User_Utils::setDeviceType(DEVICE_TYPE_MOBILE);
+
+    $this->expected = array(
+      'order_name01' => '姓01',
+      'order_email' => 'test @ example.com',
+      'customer_id' => '1001',
+      'update_date' => 'CURRENT_TIMESTAMP'
+    );
+    $helper = new SC_Helper_Purchase();
+    $helper->copyFromCustomer($dest, $this->customer, $prefix, $keys);
+    $this->actual = $dest;
+
+    $this->verify();
+  }
+
+  public function testCopyFromCustomer_モバイルでない場合_通常のメールアドレスをそのまま設定する() {
+    $dest = array();
+    $prefix = 'prefix';
+    // キーを絞る
+    $keys = array('name01', 'email');
+    User_Utils::setLoginState(TRUE, $this->customer_array, $this->objQuery);
+    User_Utils::setDeviceType(DEVICE_TYPE_PC);
+    $this->customer->setValue('email_mobile', 'mobile @ example.com');
+
+    $this->expected = array(
+      'prefix_name01' => '姓01',
+      'prefix_email' => 'test @ example.com',
+      'customer_id' => '1001',
+      'update_date' => 'CURRENT_TIMESTAMP'
+    );
+    $helper = new SC_Helper_Purchase();
+    $helper->copyFromCustomer($dest, $this->customer, $prefix, $keys);
+    $this->actual = $dest;
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php
___________________________________________________________________
追加: svn:eol-style-native
   + 
追加: svn:keywords
   + Id Rev Date

追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -0,0 +1,113 @@
+<?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::copyFromOrder()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_copyFromOrderTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    // parent::setUp();
+  }
+
+  protected function tearDown() {
+    // parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testCopyFromOrder_すべてデフォルト設定にした場合_デフォルトの接頭辞・キーでコピーされる() {
+     $dest = array();
+     $src = array(
+       'order_name01' => '姓',
+       'order_name02' => '名',
+       'order_kana01' => 'セイ',
+       'order_kana02' => 'メイ',
+       'order_sex' => '1',
+       'order_zip01' => '012',
+       'order_zip02' => '1234',
+       'order_pref' => '北海道',
+       'order_addr01' => '住所01',
+       'order_addr02' => '住所02',
+       'order_tel01' => '01',
+       'order_tel02' => '1234',
+       'order_tel03' => '5678',
+       'order_fax01' => '02',
+       'order_fax02' => '2345',
+       'order_fax03' => '6789'
+     );
+
+     $this->expected = array(
+       'shipping_name01' => '姓',
+       'shipping_name02' => '名',
+       'shipping_kana01' => 'セイ',
+       'shipping_kana02' => 'メイ',
+       'shipping_sex' => '1',
+       'shipping_zip01' => '012',
+       'shipping_zip02' => '1234',
+       'shipping_pref' => '北海道',
+       'shipping_addr01' => '住所01',
+       'shipping_addr02' => '住所02',
+       'shipping_tel01' => '01',
+       'shipping_tel02' => '1234',
+       'shipping_tel03' => '5678',
+       'shipping_fax01' => '02',
+       'shipping_fax02' => '2345',
+       'shipping_fax03' => '6789'
+     );
+     $helper = new SC_Helper_Purchase();
+     $helper->copyFromOrder($dest, $src);
+     $this->actual = $dest;
+
+     $this->verify();
+  }
+
+  public function testCopyFromOrder_接頭辞・キーを設定した場合_指定の値でコピーされる() {
+     $dest = array();
+     $src = array(
+       'input_name01' => '姓',
+       'input_name02' => '名',
+       'input_zip01' => '012' // キーに含まれないもの
+     );
+
+     $this->expected = array(
+       'output_name01' => '姓',
+       'output_name02' => '名'
+     );
+     $helper = new SC_Helper_Purchase();
+     $helper->copyFromOrder($dest, $src, 'output', 'input', array('name01', 'name02'));
+     $this->actual = $dest;
+
+     $this->verify();
+  }
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php
___________________________________________________________________
追加: svn:eol-style-native
   + 
追加: svn:keywords
   + Id Rev Date

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTest.php	2012-12-16 10:02:02 UTC (rev 22140)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -25,7 +25,7 @@
  */
 
 /**
- * SC_Helper_Purchaset::getDeliv()のテストクラス.
+ * SC_Helper_Purchase::getDeliv()のテストクラス.
  *
  *
  * @author Hiroko Tamagawa

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTimeTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTimeTest.php	2012-12-16 10:02:02 UTC (rev 22140)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTimeTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -25,7 +25,7 @@
  */
 
 /**
- * SC_Helper_Purchaset::getDelivTime()のテストクラス.
+ * SC_Helper_Purchase::getDelivTime()のテストクラス.
  *
  *
  * @author Hiroko Tamagawa

追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -0,0 +1,145 @@
+<?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::getOrderDetail()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getOrderDetailTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpOrder();
+    $this->setUpOrderDetail();
+    $this->setUpProductClass();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetOrderDetail_存在しない受注IDを指定した場合_結果が空になる() {
+    $order_id = '9999';
+
+    $this->expected = array();
+    $this->actual = SC_Helper_Purchase::getOrderDetail($order_id);
+
+    $this->verify();
+  }
+
+  public function testGetOrderDetail_存在する受注IDを指定した場合_対応する受注詳細情報が取得できる() {
+    $order_id = '1001';
+
+    $this->expected = array(
+       array(
+         'product_id' => '1002',
+         'product_class_id' => '1002',
+         'product_type_id' => '1002',
+         'product_code' => 'pc1002',
+         'product_name' => '製品名1002',
+         'classcategory_name1' => 'cat10021',
+         'classcategory_name2' => 'cat10022',
+         'price' => '3000',
+         'quantity' => '10',
+         'point_rate' => '5',
+         'status' => '3',
+         'payment_date' => '2032-12-31 01:20:30',
+         'enable' => '0',
+         'effective' => '1'
+       ),
+       array(
+         'product_id' => '1001',
+         'product_class_id' => '1001',
+         'product_type_id' => '1001',
+         'product_code' => 'pc1001',
+         'product_name' => '製品名1001',
+         'classcategory_name1' => 'cat10011',
+         'classcategory_name2' => 'cat10012',
+         'price' => '4000',
+         'quantity' => '15',
+         'point_rate' => '6',
+         'status' => '3',
+         'payment_date' => '2032-12-31 01:20:30',
+         'enable' => '1',
+         'effective' => '1'
+       )
+    );
+    $this->actual = SC_Helper_Purchase::getOrderDetail($order_id);
+
+    $this->verify();
+  }
+
+  public function testGetOrderDetail_ステータス取得フラグがOFFのの場合_ステータス以外の情報が取得できる() {
+    $order_id = '1001';
+
+    $this->expected = array(
+       array(
+         'product_id' => '1002',
+         'product_class_id' => '1002',
+         'product_type_id' => '1002',
+         'product_code' => 'pc1002',
+         'product_name' => '製品名1002',
+         'classcategory_name1' => 'cat10021',
+         'classcategory_name2' => 'cat10022',
+         'price' => '3000',
+         'quantity' => '10',
+         'point_rate' => '5',
+         // 'status' => '3',
+         // 'payment_date' => '2032-12-31 01:20:30',
+         'enable' => '0',
+         'effective' => '1'
+       ),
+       array(
+         'product_id' => '1001',
+         'product_class_id' => '1001',
+         'product_type_id' => '1001',
+         'product_code' => 'pc1001',
+         'product_name' => '製品名1001',
+         'classcategory_name1' => 'cat10011',
+         'classcategory_name2' => 'cat10012',
+         'price' => '4000',
+         'quantity' => '15',
+         'point_rate' => '6',
+         // 'status' => '3',
+         // 'payment_date' => '2032-12-31 01:20:30',
+         'enable' => '1',
+         'effective' => '1'
+       )
+    );
+    $this->actual = SC_Helper_Purchase::getOrderDetail($order_id, false);
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php
___________________________________________________________________
追加: svn:eol-style-native
   + 
追加: svn:keywords
   + Id Rev Date

追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -0,0 +1,73 @@
+<?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::getOrderTemp()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getOrderTempTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpOrderTemp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetOrderTemp_存在しない受注IDを指定した場合_結果が空になる() {
+    $order_id = '9999';
+
+    $this->expected = null;
+    $this->actual = SC_Helper_Purchase::getOrderTemp($order_id);
+
+    $this->verify();
+  }
+
+  public function testGetOrderTemp_存在する受注IDを指定した場合_対応する結果が取得できる() {
+    $order_temp_id = '1002';
+
+    $this->expected = array(
+      'order_temp_id' => '1002',
+      'customer_id' => '1002',
+      'order_name01' => '受注情報02'
+    );
+    $result = SC_Helper_Purchase::getOrderTemp($order_temp_id);
+    $this->actual = Test_Utils::mapArray($result, array('order_temp_id', 'customer_id', 'order_name01'));
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php
___________________________________________________________________
追加: svn:eol-style-native
   + 
追加: svn:keywords
   + Id Rev Date

追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -0,0 +1,98 @@
+<?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::getOrder()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getOrderTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpOrder();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetOrder_存在しない受注IDを指定した場合_結果が空になる() {
+    $order_id = '9999';
+
+    $this->expected = null;
+    $this->actual = SC_Helper_Purchase::getOrder($order_id);
+
+    $this->verify();
+  }
+
+  public function testGetOrder_存在しない顧客IDを指定した場合_結果が空になる() {
+    $order_id = '1002';
+    $customer_id = '9999';
+
+    $this->expected = null;
+    $this->actual  = SC_Helper_Purchase::getOrder($order_id, $customer_id);
+
+    $this->verify();
+  }
+
+  public function testGetOrder_顧客IDを指定しなかった場合_受注IDに対応する結果が取得できる() {
+    $order_id = '1002';
+
+    $this->expected = array(
+      'order_id' => '1002',
+      'customer_id' => '1002',
+      'order_name01' => '受注情報02'
+    );
+    $result = SC_Helper_Purchase::getOrder($order_id);
+    $this->actual = Test_Utils::mapArray($result, array('order_id', 'customer_id', 'order_name01'));
+
+    $this->verify();
+  }
+
+  public function testGetOrder_存在する顧客IDを指定した場合_対応する結果が取得できる() {
+    $order_id = '1002';
+    $customer_id = '1002';
+
+    $this->expected = array(
+      'order_id' => '1002',
+      'customer_id' => '1002',
+      'order_name01' => '受注情報02'
+    );
+    $result = SC_Helper_Purchase::getOrder($order_id, $customer_id);
+    $this->actual = Test_Utils::mapArray($result, array('order_id', 'customer_id', 'order_name01'));
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php
___________________________________________________________________
追加: svn:eol-style-native
   + 
追加: svn:keywords
   + Id Rev Date

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPaymentsIdTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPaymentsIdTest.php	2012-12-16 10:02:02 UTC (rev 22140)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPaymentsIdTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -25,7 +25,7 @@
  */
 
 /**
- * SC_Helper_Purchaset::getPaymentsByPaymentsId()のテストクラス.
+ * SC_Helper_Purchase::getPaymentsByPaymentsId()のテストクラス.
  *
  *
  * @author Hiroko Tamagawa

追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPriceTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPriceTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPriceTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -0,0 +1,116 @@
+<?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::getPaymentsByPrice()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getPaymentsByPriceTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpPayment();
+    $this->setUpPaymentOptions();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetPaymentsByPrice_購入金額がすべての上限を上回る場合_上限の設定がないものだけ取得できる() {
+    $deliv_id = '1003';
+    $total = 21001;
+    $helper = new SC_Helper_Purchase();
+
+    $this->expected['count'] = 2;
+    $this->expected['first'] = array(
+      'payment_id' => '3002',
+      'payment_method' => '支払方法3002',
+      'rule_max' => null,
+      'upper_rule' => null,
+      'note' => null,
+      'payment_image' => null,
+      'charge' => null
+    );
+    $this->expected['second_id'] = '3003';
+
+    $result = $helper->getPaymentsByPrice($total, $deliv_id);
+    $this->actual['count'] = count($result);
+    $this->actual['first'] = $result[0];
+    $this->actual['second_id'] = $result[1]['payment_id'];
+
+    $this->verify();
+  }
+
+  public function testGetPaymentsByPrice_購入金額が一部の上限を上回る場合_上限に引っかからないものだけ取得できる() {
+    $deliv_id = '1003';
+    $total = 20500;
+    $helper = new SC_Helper_Purchase();
+
+    $this->expected = array('3002', '3003', '3005');
+
+    $result = $helper->getPaymentsByPrice($total, $deliv_id);
+    $this->actual = Test_Utils::mapCols($result, 'payment_id');
+
+    $this->verify();
+  }
+
+  public function testGetPaymentsByPrice_購入金額が一部の下限を下回る場合_下限に引っかからないものだけ取得できる() {
+    $deliv_id = '1003';
+    $total = 11000;
+    $helper = new SC_Helper_Purchase();
+
+    $this->expected = array('3002', '3003', '3004');
+
+    $result = $helper->getPaymentsByPrice($total, $deliv_id);
+    $this->actual = Test_Utils::mapCols($result, 'payment_id');
+
+    $this->verify();
+  }
+
+  public function testGetPaymentsByPrice_購入金額がすべての下限を下回る場合_下限の設定がないものだけ取得できる() {
+    $deliv_id = '1003';
+    $total = 9999;
+    $helper = new SC_Helper_Purchase();
+
+    $this->expected = array('3002', '3004');
+
+    $result = $helper->getPaymentsByPrice($total, $deliv_id);
+    $this->actual = Test_Utils::mapCols($result, 'payment_id');
+
+    $this->verify();
+  }
+
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPriceTest.php
___________________________________________________________________
追加: svn:eol-style-native
   + 
追加: svn:keywords
   + Id Rev Date

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsTest.php	2012-12-16 10:02:02 UTC (rev 22140)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -25,7 +25,7 @@
  */
 
 /**
- * SC_Helper_Purchaset::getPayments()のテストクラス.
+ * SC_Helper_Purchase::getPayments()のテストクラス.
  *
  *
  * @author Hiroko Tamagawa

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php	2012-12-16 10:02:02 UTC (rev 22140)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -25,7 +25,7 @@
  */
 
 /**
- * SC_Helper_Purchaset::getShipmentItems()のテストクラス.
+ * SC_Helper_Purchase::getShipmentItems()のテストクラス.
  *
  *
  * @author Hiroko Tamagawa

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php	2012-12-16 10:02:02 UTC (rev 22140)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -25,7 +25,7 @@
  */
 
 /**
- * SC_Helper_Purchaset::getShippings()のテストクラス.
+ * SC_Helper_Purchase::getShippings()のテストクラス.
  *
  *
  * @author Hiroko Tamagawa

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php	2012-12-16 10:02:02 UTC (rev 22140)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -25,7 +25,7 @@
  */
 
 /**
- * SC_Helper_Purchaset::registerShipmentItem()のテストクラス.
+ * SC_Helper_Purchase::registerShipmentItem()のテストクラス.
  *
  *
  * @author Hiroko Tamagawa

追加: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php	2012-12-16 13:58:26 UTC (rev 22141)
@@ -0,0 +1,110 @@
+<?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::setDownloadableFlgTo()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_setDownloadableFlgToTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    // parent::setUp();
+  }
+
+  protected function tearDown() {
+    // parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSetDownloadableFlgTo_販売価格が0円の場合_フラグがONになる() {
+    $input = array(
+      '1001' => array('price' => 0)
+    );
+    
+    $this->expected = true;
+    SC_Helper_Purchase::setDownloadableFlgTo($input);
+    $this->actual = $input['1001']['is_downloadable'];
+
+    $this->verify('ダウンロード可能フラグ設定結果');
+  }
+
+  public function testSetDownloadableFlgTo_ダウンロード期限内かつ入金日ありの場合_フラグがONになる() {
+    $input = array(
+      '1001' => array('price' => 1000, 'effective' => '1', 'payment_date' => '2012-12-12')
+    );
+    
+    $this->expected = true;
+    SC_Helper_Purchase::setDownloadableFlgTo($input);
+    $this->actual = $input['1001']['is_downloadable'];
+
+    $this->verify('ダウンロード可能フラグ設定結果');
+  }
+
+  public function testSetDownloadableFlgTo_ダウンロード期限内かつ入金日なしの場合_フラグがOFFになる() {
+    $input = array(
+      '1001' => array('price' => 1000, 'effective' => '1', 'payment_date' => null)
+    );
+    
+    $this->expected = false;
+    SC_Helper_Purchase::setDownloadableFlgTo($input);
+    $this->actual = $input['1001']['is_downloadable'];
+
+    $this->verify('ダウンロード可能フラグ設定結果');
+  }
+
+  public function testSetDownloadableFlgTo_ダウンロード期限外かつ入金日ありの場合_フラグがOFFになる() {
+    $input = array(
+      '1001' => array('price' => 1000, 'effective' => '0', 'payment_date' => '2012-12-12')
+    );
+    
+    $this->expected = false;
+    SC_Helper_Purchase::setDownloadableFlgTo($input);
+    $this->actual = $input['1001']['is_downloadable'];
+
+    $this->verify('ダウンロード可能フラグ設定結果');
+  }
+
+  public function testSetDownloadableFlgTo_ダウンロード期限外かつ入金日なしの場合_フラグがOFFになる() {
+    $input = array(
+      '1001' => array('price' => 1000, 'effective' => '0', 'payment_date' => null)
+    );
+    
+    $this->expected = false;
+    SC_Helper_Purchase::setDownloadableFlgTo($input);
+    $this->actual = $input['1001']['is_downloadable'];
+
+    $this->verify('ダウンロード可能フラグ設定結果');
+  }
+
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php
___________________________________________________________________
追加: svn:eol-style-native
   + 
追加: svn:keywords
   + Id Rev Date




Svn-src-all メーリングリストの案内