[Svn-src-all:3238] [version-2_12-dev 22139] 一部単体テストを追加(SC_Utils.php/SC_Helper_Purchase.php)

shift_hiroko.tamagawa admin @ mail.ec-cube.net
2012年 12月 16日 (日) 11:18:19 JST


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

Log:
--------------------------------------------------------
一部単体テストを追加(SC_Utils.php/SC_Helper_Purchase.php)

Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
U   branches/version-2_12-dev/tests/class/Common_TestCase.php
D   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_BaseTest.php
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_getDelivTest.php
A   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_getPaymentsByPaymentsIdTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsTest.php
A   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_getShippingPrefTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php
A   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php
U   branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php
A   branches/version-2_12-dev/tests/class/test/util/Test_Utils.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getRealURLTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrayIntersectKeysTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypeHmacTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetTimestampTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfIsHTTPSTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPassLenTest.php
A   branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfTrimURLTest.php

変更: branches/version-2_12-dev/tests/class/Common_TestCase.php
===================================================================
--- branches/version-2_12-dev/tests/class/Common_TestCase.php	2012-12-15 10:08:08 UTC (rev 22138)
+++ branches/version-2_12-dev/tests/class/Common_TestCase.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -3,6 +3,7 @@
 $HOME = realpath(dirname(__FILE__)) . "/../..";
 require_once($HOME . "/tests/class/replace/SC_Display_Ex.php");
 require_once($HOME . "/tests/class/replace/SC_Response_Ex.php");
+require_once($HOME . "/tests/class/test/util/Test_Utils.php");
 require_once($HOME . "/tests/class/test/util/User_Utils.php");
 require_once($HOME . "/tests/require.php");
 

削除: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_BaseTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_BaseTest.php	2012-12-15 10:08:08 UTC (rev 22138)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_BaseTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -1,60 +0,0 @@
-<?php
-
-$HOME = realpath(dirname(__FILE__)) . "/../../../..";
-require_once($HOME . "/tests/class/Common_TestCase.php");
-/**
- *
- */
-class SC_Helper_Purchase_BaseTest extends Common_TestCase {
-
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  protected function tearDown() {
-    parent::tearDown();
-  }
-
-  /////////////////////////////////////////
-  /**
-   * セッションに配送情報を設定します。
-   */
-  protected function setUpShipping($shipping) {
-    if (!$shipping) {
-      $shipping = getSingleShipping(); 
-    }
-
-    $_SESSION['shipping'] = $shipping;
-  }
-
-  protected function getSingleShipping() {
-    return array(
-      '00001' => array(
-        'shipment_id' => '00001',
-        'shipment_item' => '商品1',
-        'shipping_pref' => '東京都')
-    );
-  }
-
-  protected function getMultipleShipping() {
-    return array(
-      '00001' => array(
-        'shipment_id' => '00001',
-        'shipment_item' => array('商品1'),
-        'shipping_pref' => '東京都'),
-      '00002' => array(
-        'shipment_id' => '00002',
-        'shipment_item' => array('商品2'),
-        'shipping_pref' => '沖縄県'),
-      '00003' => array(
-        'shipment_id' => '00003',
-        'shipment_item' => array(),
-        'shipping_pref' => '埼玉県')
-    );
-  }
-
-  protected function setUpShippingDb($shipping) {
-    
-  }
-}
-

変更: 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-15 10:08:08 UTC (rev 22138)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -57,22 +57,236 @@
    * DBに配送情報を設定します。
    */
   protected function setUpShippingOnDb() {
-    $data = array(
+    $shippings = array(
       array(
-        'shipping_id' => '00001',
-        'order_id' => '00001',
+        'shipping_id' => '1',
+        'order_id' => '1',
         'shipping_name01' => '配送情報01',
         'shipping_date' => '2012-01-12'
       ),
       array(
-        'shipping_id' => '00002',
-        'order_id' => '00002',
+        'shipping_id' => '2',
+        'order_id' => '2',
         'shipping_name01' => '配送情報02',
         'shipping_date' => '2011-10-01'
       )
     );
-    $this->objQuery->insert('dtb_shipping', $data[0]);
-    $this->objQuery->insert('dtb_shipping', $data[1]);
+
+    foreach ($shippings as $key => $item) {
+      $this->objQuery->insert('dtb_shipping', $item);
+    }
   }
+
+  /**
+   * DBに配送商品情報を設定します。
+   */
+  protected function setUpShipmentItem() {
+      $shipping_items = array(
+        array(
+          'shipping_id' => '1',
+          'product_class_id' => '1001',
+          'order_id' => '1',
+          'product_name' => '商品名01',
+          'price' => '1500'
+        ),
+        array(
+          'shipping_id' => '1',
+          'product_class_id' => '1002',
+          'order_id' => '1',
+          'product_name' => '商品名02',
+          'price' => '2400'
+        )
+      );
+
+    foreach ($shipping_items as $key => $item) {
+      $this->objQuery->insert('dtb_shipment_item', $item);
+    }
+    $this->setUpProductClass();
+  }
+
+  /**
+   * DBに商品クラス情報を設定します.
+   */
+  protected function setUpProductClass() {
+      $product_class = array(
+        array(
+          'product_class_id' => '1001',
+          'product_id' => '1001',
+          'product_code' => 'code1001',
+          'classcategory_id1' => '1001',
+          'classcategory_id2' => '1002',
+          'price01' => '1500',
+          'price02' => '1500',
+          'del_flg' => '0'
+        ),
+        array(
+          'product_class_id' => '1002',
+          'product_id' => '1002',
+          'del_flg' => '0'
+        )
+      );
+
+    foreach ($product_class as $key => $item) {
+      $this->objQuery->insert('dtb_products_class', $item);
+    }
+    $this->setUpClassCategory();
+    $this->setUpProducts();
+  }
+
+  /**
+   * DBに製品カテゴリ情報を登録します.
+   */
+  protected function setUpClassCategory() {
+    $class_category = array(
+      array(
+        'classcategory_id' => '1001',
+        'name' => 'cat1001'
+      ),
+      array(
+        'classcategory_id' => '1002',
+        'name' => 'cat1002'
+      )
+    );
+
+    foreach ($class_category as $key => $item) {
+      $this->objQuery->insert('dtb_classcategory', $item);
+    }
+  }
+
+  /** 
+   * DBに製品情報を登録します.
+   */
+ protected function setUpProducts() {
+   $products = array(
+     array(
+       'product_id' => '1001',
+       'name' => '製品名1001'
+     ),
+     array(
+       'product_id' => '1002',
+       'name' => '製品名1002'
+     )
+   );
+
+   foreach ($products as $key => $item) {
+     $this->objQuery->insert('dtb_products', $item);
+   }
+ }
+
+ /**
+  * DBに支払方法の情報を登録します.
+  */
+ protected function setUpPaymentOptions() {
+   $payment_options = array(
+     array(
+       'deliv_id' => '2001',
+       'payment_id' => '2001',
+       'rank' => '1'
+     ),
+     array(
+       'deliv_id' => '1001',
+       'payment_id' => '1001',
+       'rank' => '2'
+     ),
+     array(
+       'deliv_id' => '1001',
+       'payment_id' => '1002',
+       'rank' => '1'
+     )
+   );
+
+   foreach ($payment_options as $key => $item) {
+     $this->objQuery->insert('dtb_payment_options', $item);
+   }
+ }
+ 
+ /**
+  * DBに配送業者の情報を登録します.
+  */
+ protected function setUpDeliv() {
+   $deliv = array(
+     array(  // 削除フラグON
+       'deliv_id' => '2001',
+       'product_type_id' => '1001',
+       'name' => '配送業者del',
+       'rank' => '1',
+       'del_flg' => '1'
+     ),
+     array(
+       'deliv_id' => '1001',
+       'product_type_id' => '1001',
+       'name' => '配送業者01',
+       'rank' => '2'
+     ),
+     array(
+       'deliv_id' => '1002',
+       'product_type_id' => '1001',
+       'name' => '配送業者02',
+       'rank' => '3'
+     ),
+     array( // 商品種別違い
+       'deliv_id' => '1004',
+       'product_type_id' => '2001',
+       'name' => '配送業者21',
+       'rank' => '4'
+     ),
+   );
+
+   foreach ($deliv as $key => $item) {
+     $this->objQuery->insert('dtb_deliv', $item);
+   }
+ }
+
+ /**
+  * DBにお届け時間の情報を登録します.
+  */
+ protected function setUpDelivTime() {
+   $deliv_time = array(
+     array(
+       'deliv_id' => '1002',
+       'time_id' => '1',
+       'deliv_time' => '午前'
+     ),
+     array(
+       'deliv_id' => '1001',
+       'time_id' => '2',
+       'deliv_time' => '午後'
+     ),
+     array(
+       'deliv_id' => '1001',
+       'time_id' => '1',
+       'deliv_time' => '午前'
+     ),
+   );
+
+   foreach ($deliv_time as $key => $item) {
+     $this->objQuery->insert('dtb_delivtime', $item);
+   }
+ }
+
+ /**
+  * DBに支払方法の情報を登録します.
+  */
+ protected function setUpPayment() {
+   $payment = array(
+     array(
+       'payment_id' => '1001',
+       'payment_method' => '支払方法1001'
+     ),
+     array(
+       'payment_id' => '1002',
+       'payment_method' => '支払方法1002',
+       'del_flg' => '1'
+     ),
+     array(
+       'payment_id' => '1003',
+       'payment_method' => '支払方法1003'
+     )
+   );
+
+   foreach ($payment as $key => $item) {
+     $this->objQuery->insert('dtb_payment', $item);
+   }
+ }
 }
 

追加: 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	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,87 @@
+<?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_Purchaset::getDeliv()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getDelivTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpDeliv();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetDeliv_存在しない商品種別IDを指定した場合_結果が空になる() {
+    $product_type_id = '9999'; // 存在しないID
+
+    $this->expected = array();
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getDeliv($product_type_id);
+
+    $this->verify('配送業者');
+  }
+
+  public function testGetDeliv_存在する商品種別IDを指定した場合_結果が正しい順序で取得できる() {
+    $product_type_id = '1001';
+  
+    $this->expected['count'] = 2;
+    $this->expected['first'] = array(
+      'deliv_id' => '1002',
+      'product_type_id' => '1001',
+      'name' => '配送業者02',
+      'rank' => '3'
+    );
+    $this->expected['second'] = array(
+      'deliv_id' => '1001',
+      'product_type_id' => '1001',
+      'name' => '配送業者01',
+      'rank' => '2'
+    );
+
+    $helper = new SC_Helper_Purchase();
+    $result = $helper->getDeliv($product_type_id);
+    $this->actual['count'] = count($result);
+    $cols = array('deliv_id', 'product_type_id', 'name', 'rank');
+    $this->actual['first'] = Test_Utils::mapArray($result[0], $cols);
+    $this->actual['second'] = Test_Utils::mapArray($result[1], $cols);
+
+    $this->verify('配送業者');
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: 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	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTimeTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,74 @@
+<?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_Purchaset::getDelivTime()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getDelivTimeTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpDelivTime();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetDelivTime_存在しない配送業者IDを指定した場合_結果が空になる() {
+    $deliv_id = '100'; // 存在しないID
+
+    $this->expected = array();
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getDelivTime($deliv_id);
+
+    $this->verify('お届け時間');
+  }
+
+  public function testGetDelivTime_存在する配送業者IDを指定した場合_結果が正しい順序で取得できる() {
+    $deliv_id = '1001';
+  
+    $this->expected = array(
+      '1' => '午前',
+      '2' => '午後'
+    );
+
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getDelivTime($deliv_id);
+    
+    $this->verify('お届け時間');
+  }
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTimeTest.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	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPaymentsIdTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,85 @@
+<?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_Purchaset::getPaymentsByPaymentsId()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getPaymentsByPaymentsIdTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpPayment();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetPaymentsByPaymentsId_存在しない支払IDを指定した場合_結果が空になる() {
+    $payment_id = '9999'; // 存在しないID
+  
+    $this->expected = null;
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getPaymentsByPaymentsId($payment_id);
+
+    $this->verify('支払方法');
+  }
+
+  public function testGetPaymentsByPaymentsId_存在する支払IDを指定した場合_対応する支払方法の情報が取得できる() {
+    $payment_id = '1001';
+  
+    $this->expected = array(
+      'payment_id' => '1001',
+      'payment_method' => '支払方法1001'
+    );
+
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getPaymentsByPaymentsId($payment_id);
+    $this->actual = Test_Utils::mapArray($this->actual, array('payment_id', 'payment_method'));
+
+    $this->verify('支払方法');
+  }
+
+  public function testGetPaymentsByPaymentsId_削除されている支払IDを指定した場合_結果が空になる() {
+    $payment_id = '1002'; // 削除済みのID
+  
+    $this->expected = null;
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getPaymentsByPaymentsId($payment_id);
+
+    $this->verify('支払方法');
+  }
+
+  //////////////////////////////////////////
+
+}
+


Property changes on: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsByPaymentsIdTest.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	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getPaymentsTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,71 @@
+<?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_Purchaset::getPayments()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getPaymentsTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpPaymentOptions();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetPayments_存在しない配送業者IDを指定した場合_結果が空になる() {
+    $deliv_id = '100'; // 存在しないID
+
+    $this->expected = array();
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getPayments($deliv_id);
+
+    $this->verify('支払方法');
+  }
+
+  public function testGetPayments_存在する配送業者IDを指定した場合_結果が正しい順序で取得できる() {
+    $deliv_id = '1001';
+  
+    $this->expected = array('1002', '1001');
+
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getPayments($deliv_id);
+    
+    $this->verify('支払方法');
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: 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	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,134 @@
+<?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_Purchaset::getShipmentItems()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getShipmentItemsTest extends SC_Helper_Purchase_TestBase {
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpShipmentItem();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetShipmentItems_存在しない受注IDを指定した場合_結果が空になる() {
+    $order_id = '100'; // 存在しないID
+    $shipping_id = '1';
+
+    $this->expected = array();
+    $this->actual = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id);
+
+    $this->verify('配送情報');
+  }
+
+  public function testGetShipmentItems_存在しない配送先IDを指定した場合_結果が空になる() {
+    $order_id = '1';
+    $shipping_id = '100'; // 存在しないID
+
+    $this->expected = array();
+    $this->actual = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id);
+
+    $this->verify('配送情報');
+  }
+
+  public function testGetShipmentItems_存在する受注IDと配送先IDを指定した場合_結果が取得できる() {
+    $order_id = '1';
+    $shipping_id = '1';
+    
+    $this->expected['count'] = 2;
+    $this->expected['first'] = array(
+      'order_id' => '1',
+      'shipping_id' => '1',
+      'product_class_id' => '1001',
+      'product_name' => '商品名01',
+      'price' => '1500',
+      'productsClass' => array('product_class_id' => '1001', 'product_id' => '1001')
+    );
+    $this->expected['second'] = array(
+      'order_id' => '1',
+      'shipping_id' => '1',
+      'product_class_id' => '1002',
+      'product_name' => '商品名02',
+      'price' => '2400',
+      'productsClass' => array('product_class_id' => '1002', 'product_id' => '1002')
+    );
+
+    $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id);
+    $this->actual['count'] = count($result);
+    $this->actual['first'] = Test_Utils::mapArray($result[0], array(
+      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
+    $this->actual['first']['productsClass'] = Test_Utils::mapArray($this->actual['first']['productsClass'], array('product_class_id', 'product_id'));
+    $this->actual['second'] = Test_Utils::mapArray($result[1], array(
+      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
+    $this->actual['second']['productsClass'] = Test_Utils::mapArray($this->actual['second']['productsClass'], array('product_class_id', 'product_id'));
+    $this->verify('配送情報');
+  }
+
+  public function testGetShipmentItems_詳細フラグをOFFにした場合_結果に詳細情報が含まれない() {
+    $order_id = '1';
+    $shipping_id = '1';
+    
+    $this->expected['count'] = 2;
+    $this->expected['first'] = array(
+      'order_id' => '1',
+      'shipping_id' => '1',
+      'product_class_id' => '1001',
+      'product_name' => '商品名01',
+      'price' => '1500',
+      'productsClass' => null
+    );
+    $this->expected['second'] = array(
+      'order_id' => '1',
+      'shipping_id' => '1',
+      'product_class_id' => '1002',
+      'product_name' => '商品名02',
+      'price' => '2400',
+      'productsClass' => null
+    );
+
+    $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id, false);
+    $this->actual['count'] = count($result);
+    $this->actual['first'] = Test_Utils::mapArray($result[0], array(
+      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
+    $this->actual['second'] = Test_Utils::mapArray($result[1], array(
+      'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
+    $this->verify('配送情報');
+
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingPrefTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingPrefTest.php	2012-12-15 10:08:08 UTC (rev 22138)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingPrefTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -1,7 +1,7 @@
 <?php
 
 $HOME = realpath(dirname(__FILE__)) . "/../../../..";
-require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestiBase.php");
+require_once($HOME . "/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_getShippingsTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,106 @@
+<?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_Purchaset::getShippings()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_getShippingsTest extends SC_Helper_Purchase_TestBase {
+
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpShipmentItem();
+    $this->setUpShippingOnDb();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testGetShippings_存在しない受注IDを指定した場合_結果が空になる() {
+    $order_id = '100'; // 存在しないID
+
+    $this->expected = array();
+    $helper = new SC_Helper_Purchase();
+    $this->actual = $helper->getShippings($order_id);
+
+    $this->verify('配送情報');
+  }
+
+  public function testGetShippings_存在する受注IDを指定した場合_結果が取得できる() {
+    $order_id = '1';
+  
+    $this->expected['count'] = 1;
+    $this->expected['first'] = array(
+      'order_id' => '1',
+      'shipping_id' => '1',
+      'shipping_name01' => '配送情報01',
+      'shipping_date' => '2012-01-12 00:00:00'
+    );
+    $this->expected['shipment_item_count'] = 2;
+
+    $helper = new SC_Helper_Purchase();
+    $result = $helper->getShippings($order_id);
+    $this->actual['count'] = count($result);
+    // shipping_idごとの配列になっているのでshipping_idで抽出
+    $this->actual['first'] = Test_Utils::mapArray($result['1'], array(
+      'order_id', 'shipping_id', 'shipping_name01', 'shipping_date'));
+    $this->actual['shipment_item_count'] = count($result['1']['shipment_item']); 
+    $this->verify('配送情報');
+  }
+
+  public function testGetShippings_商品取得フラグをOFFにした場合_結果に商品情報が含まれない() {
+    $order_id = '1';
+    
+    $this->expected['count'] = 1;
+    $this->expected['first'] = array(
+      'order_id' => '1',
+      'shipping_id' => '1',
+      'shipping_name01' => '配送情報01',
+      'shipping_date' => '2012-01-12 00:00:00'
+    );
+    $this->expected['shipment_item_count'] = 0;
+
+    $helper = new SC_Helper_Purchase();
+    $result = $helper->getShippings($order_id, false);
+    $this->actual['count'] = count($result);
+    // shipping_idごとの配列になっているのでshipping_idで抽出
+    $this->actual['first'] = Test_Utils::mapArray($result['1'], array(
+      'order_id', 'shipping_id', 'shipping_name01', 'shipping_date'));
+    $this->actual['shipment_item_count'] = count($result['1']['shipment_item']);
+    $this->verify('配送情報');
+
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: 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	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,205 @@
+<?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_Purchaset::registerShipmentItem()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Helper_Purchase_registerShipmentItemTest extends SC_Helper_Purchase_TestBase {
+
+  protected function setUp() {
+    parent::setUp();
+    $this->setUpShipmentItem();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testRegisterShipmentItem_製品クラスIDが入っていない場合_登録を行わない() {
+    // 引数の設定
+    $order_id = '1';
+    $shipping_id = '1';
+    $arrParams = array(
+      array(
+        // 'product_class_id' => '1',
+        'product_name' => '追加製品名01',
+        'product_code' => 'newcode01',
+        'classcategory_name1' => 'newcat01',
+        'classcategory_name2' => 'newcat02',
+        'price' => '2500'
+      )
+    );
+
+    // 期待値の設定
+    $this->expected['count'] = 0;
+
+    // 対象functionの呼び出し
+    SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams);
+    $result = $this->objQuery->select(
+      'product_class_id,product_name,product_code,classcategory_name1,classcategory_name2,price',
+      'dtb_shipment_item',
+      'order_id = ? and shipping_id = ?',
+      array($order_id, $shipping_id)
+    );
+    $this->actual['count'] = count($result);
+
+    $this->verify('登録された配送商品情報');
+  }
+
+  public function testRegisterShipmentItem_製品名等が指定されている場合_指定された値で登録を行う() {
+    // 引数の設定
+    $order_id = '1';
+    $shipping_id = '1';
+    $arrParams = array(
+      array(
+        'product_class_id' => '1',
+        'product_name' => '追加製品名01',
+        'product_code' => 'newcode01',
+        'classcategory_name1' => 'newcat01',
+        'classcategory_name2' => 'newcat02',
+        'price' => '2500'
+      )
+    );
+
+    // 期待値の設定
+    $this->expected['count'] = 1;
+    $this->expected['first'] = array(
+      'product_class_id' => '1',
+      'product_name' => '追加製品名01',
+      'product_code' => 'newcode01',
+      'classcategory_name1' => 'newcat01',
+      'classcategory_name2' => 'newcat02',
+      'price' => '2500'
+    );
+
+    // 対象functionの呼び出し
+    SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams);
+    $result = $this->objQuery->select(
+      'product_class_id,product_name,product_code,classcategory_name1,classcategory_name2,price',
+      'dtb_shipment_item',
+      'order_id = ? and shipping_id = ?',
+      array($order_id, $shipping_id)
+    );
+    $this->actual['count'] = count($result);
+    $this->actual['first'] = $result[0];
+
+    $this->verify('登録された配送商品情報');
+  }
+
+  public function testRegisterShipmentItem_製品名等が指定されていない場合_DBからマスタ情報を取得して登録を行う() {
+    // 引数の設定
+    $order_id = '1';
+    $shipping_id = '1';
+    $arrParams = array(
+      array(
+        'product_class_id' => '1001'
+        // 'product_name' => '追加製品名01',
+        // 'product_code' => 'newcode01',
+        // 'classcategory_name1' => 'newcat01',
+        // 'classcategory_name2' => 'newcat02',
+        // 'price' => '2500'
+      )
+    );
+
+    // 期待値の設定
+    $this->expected['count'] = 1;
+    $this->expected['first'] = array(
+      'product_class_id' => '1001',
+      'product_name' => '製品名1001',
+      'product_code' => 'code1001',
+      'classcategory_name1' => 'cat1001',
+      'classcategory_name2' => 'cat1002',
+  // TODO 要確認price01, price02を設定しても価格が取れない。実際にはDBから取るケースが無い?
+      //'price' => '1500'
+      'price' => null
+    );
+
+    // 対象functionの呼び出し
+    SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams);
+    $result = $this->objQuery->select(
+      'product_class_id,product_name,product_code,classcategory_name1,classcategory_name2,price',
+      'dtb_shipment_item',
+      'order_id = ? and shipping_id = ?',
+      array($order_id, $shipping_id)
+    );
+    $this->actual['count'] = count($result);
+    $this->actual['first'] = $result[0];
+
+    $this->verify('登録された配送商品情報');
+
+  }
+
+  public function testRegisterShipmentItem_DBに存在しないカラムを指定した場合_エラーなく登録できる() {
+    // 引数の設定
+    $order_id = '1';
+    $shipping_id = '1';
+    $arrParams = array(
+      array(
+        'product_class_id' => '1',
+        'product_name' => '追加製品名01',
+        'product_code' => 'newcode01',
+        'classcategory_name1' => 'newcat01',
+        'classcategory_name2' => 'newcat02',
+        'price' => '2500',
+        'xxxx' => 'yyyyyy' // 存在しないカラム
+      )
+    );
+
+    // 期待値の設定
+    $this->expected['count'] = 1;
+    $this->expected['first'] = array(
+      'product_class_id' => '1',
+      'product_name' => '追加製品名01',
+      'product_code' => 'newcode01',
+      'classcategory_name1' => 'newcat01',
+      'classcategory_name2' => 'newcat02',
+      'price' => '2500'
+    );
+
+    // 対象functionの呼び出し
+    SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams);
+    $result = $this->objQuery->select(
+      'product_class_id,product_name,product_code,classcategory_name1,classcategory_name2,price',
+      'dtb_shipment_item',
+      'order_id = ? and shipping_id = ?',
+      array($order_id, $shipping_id)
+    );
+    $this->actual['count'] = count($result);
+    $this->actual['first'] = $result[0];
+
+    $this->verify('登録された配送商品情報');
+
+  }
+  
+  //////////////////////////////////////////
+
+}
+


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

変更: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php	2012-12-15 10:08:08 UTC (rev 22138)
+++ branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -17,7 +17,7 @@
   }
 
   /////////////////////////////////////////
-  public function testRegsiterShipping_元々存在しない受注IDの場合_新規にデータが作られる() {
+  public function testRegisterShipping_元々存在しない受注IDの場合_新規にデータが作られる() {
     $order_id = '10';
     $arrParams = array(
         '20' =>

追加: branches/version-2_12-dev/tests/class/test/util/Test_Utils.php
===================================================================
--- branches/version-2_12-dev/tests/class/test/util/Test_Utils.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/test/util/Test_Utils.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,52 @@
+<?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.
+ */
+
+/**
+ * テストケースで使う一般的なユーティリティを持つクラス.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class Test_Utils {
+
+  /**
+   * 連想配列から指定されたキーだけを抜き出したものを返します.
+   * 入力の連想配列には変更を加えません.
+   *
+   * @static
+   * @param input_array 入力の連想配列
+   * @param map_keys 出力結果に入れたいキーを配列で指定します
+   * @return 指定したキーのみを持つ連想配列
+   */
+  public static function mapArray($input_array, $map_keys) {
+    $output_array = array();
+    foreach ($map_keys as $index => $map_key) {
+      $output_array[$map_key] = $input_array[$map_key];
+    }
+
+    return $output_array;
+  }
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,75 @@
+<?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::arrayDefineIndexes()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_arrayDefineIndexesTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testArrayDefineIndexes_チェック対象のキーがすべて存在する場合_配列に変化がない() {
+    $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
+    $defineIndexes = array('banana', 'orange');
+
+    $this->expected = $input_array;
+    $this->actual = SC_Utils::arrayDefineIndexes($input_array, $defineIndexes);
+
+    $this->verify();
+  }
+
+  public function testArrayDefineIndexes_チェック対象のキーが一部存在しない場合_配列に追加される() {
+    $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
+    $defineIndexes = array('tomato', 'banana', 'kiwi');
+
+    $this->expected = array(
+      'apple' => 'りんご',
+      'banana' => 'バナナ',
+      'orange' => 'オレンジ',
+      'tomato' => '',
+      'kiwi' => ''
+    );
+    $this->actual = SC_Utils::arrayDefineIndexes($input_array, $defineIndexes);
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getRealURLTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getRealURLTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getRealURLTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,81 @@
+<?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::getRealURL()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_getRealURLTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  // TODO ポート番号のためのコロンが必ず入ってしまうのはOK?
+  public function testGetRealURL_親ディレクトリへの参照を含む場合_正しくパースできる() {
+    $input = 'http://www.example.jp/aaa/../index.php';
+    $this->expected = 'http://www.example.jp:/index.php';
+    $this->actual = SC_Utils::getRealURL($input);
+
+    $this->verify();
+  }
+
+  public function testGetRealURL_親ディレクトリへの参照を複数回含む場合_正しくパースできる() {
+    $input = 'http://www.example.jp/aaa/bbb/../../ccc/ddd/../index.php';
+    $this->expected = 'http://www.example.jp:/ccc/index.php';
+    $this->actual = SC_Utils::getRealURL($input);
+
+    $this->verify();
+  }
+
+  public function testGetRealURL_カレントディレクトリへの参照を含む場合_正しくパースできる() {
+    $input = 'http://www.example.jp/aaa/./index.php';
+    $this->expected = 'http://www.example.jp:/aaa/index.php';
+    $this->actual = SC_Utils::getRealURL($input);
+
+    $this->verify();
+  }
+
+  public function testGetRealURL_httpsの場合_正しくパースできる() {
+    $input = 'https://www.example.jp/aaa/./index.php';
+    $this->expected = 'https://www.example.jp:/aaa/index.php';
+    $this->actual = SC_Utils::getRealURL($input);
+
+    $this->verify();
+  }
+  //////////////////////////////////////////
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrayIntersectKeysTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrayIntersectKeysTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrayIntersectKeysTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,69 @@
+<?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::sfArrayIntersectKeys()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfArrayIntersectKeysTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfArrayIntersectKeys_指定キーに含まれるものがない場合_空の配列が返る() {
+    $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
+    $key_array = array('kiwi', 'tomato');
+
+    $this->expected = array();
+    $this->actual = SC_Utils::sfArrayIntersectKeys($input_array, $key_array);
+
+    $this->verify();
+  }
+
+  public function testSfArrayIntersctKeys_指定キーに含まれるものがある場合_含まれるものだけが返る() {
+    $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
+    $key_array = array('orange', 'apple');
+
+    $this->expected = array('apple' => 'りんご', 'orange' => 'オレンジ');
+    $this->actual = SC_Utils::sfArrayIntersectKeys($input_array, $key_array);
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypeHmacTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypeHmacTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypeHmacTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,65 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// このテスト専用の定数の設定
+define('AUTH_TYPE', 'HMAC');
+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::sfGetHashString()のテストクラス.
+ * 暗号化結果の詳細までは見られないため、変換がされていることだけを確かめます。
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetHashString_authTypeHmacTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfGetHashString_暗号化ありの設定になっている場合_文字列が変換される() {
+    $input = 'hello, world';
+    $salt = 'sample';
+
+    $output = SC_Utils::sfGetHashString($input, $salt);
+
+    $this->assertNotEquals('入力前後の文字列', $input, $output);
+  }
+
+  public function testSfGetHashString_暗号化ありの設定になっていてsaltがない場合_文字列が変換される() {
+    $input = 'hello, world';
+    $output = SC_Utils::sfGetHashString($input);
+
+    $this->assertNotEquals('入力前後の文字列', $input, $output);
+  }
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,58 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// このテスト専用の定数の設定
+define('AUTH_TYPE', 'PLAIN');
+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::sfGetHashString()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetHashString_authTypePlainTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfGetHashString_暗号化なしの設定になっている場合_文字列が変換されない() {
+    $input = 'hello, world';
+
+    $this->expected = $input;
+    $this->actual = SC_Utils::sfGetHashString($input);
+
+    $this->verify();
+  }
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetTimestampTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetTimestampTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetTimestampTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -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::sfGetTimestamp()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetTimestampTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfGetTimestamp_年が設定されていない場合_0バイト文字列が返る() {
+    $year = '';
+    $month = '10';
+    $day = '23';
+
+    $this->expected = '';
+    $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day);
+    $this->verify();
+  }
+
+  public function testSfGetTimestamp_月が設定されていない場合_0バイト文字列が返る() {
+    $year = '2012';
+    $month = '';
+    $day = '13';
+
+    $this->expected = '';
+    $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day);
+    $this->verify();
+  }
+
+  public function testSfGetTimestamp_日が設定されていない場合_0バイト文字列が返る() {
+    $year = '1999';
+    $month = '09';
+    $day = '';
+
+    $this->expected = '';
+    $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day);
+    $this->verify();
+  }
+
+  public function testSfGetTimestamp_年月日すべて設定されている場合_連結された文字列が返る() {
+    $year = '1999';
+    $month = '09';
+    $day = '23';
+
+    $this->expected = '1999-09-23 00:00:00';
+    $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day);
+
+    $this->verify();
+  }
+
+  public function testSfGetTimestamp_最終時刻フラグがONの場合_時刻が深夜のものになる() {
+    $year = '1999';
+    $month = '09';
+    $day = '23';
+
+    $this->expected = '1999-09-23 23:59:59';
+    $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day, true);
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfIsHTTPSTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfIsHTTPSTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfIsHTTPSTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,73 @@
+<?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::sfIsHTTPS()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfIsHTTPSTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfIsHTTPS_環境変数にSSLを示す値が入っている場合_trueが返る() {
+    $_SERVER['HTTPS'] = 'on';
+    $this->expected = true;
+    $this->actual = SC_Utils::sfIsHTTPS();
+
+    $this->verify();
+  }
+
+  public function testSfIsHTTPS_環境変数に非SSLを示す値が入っている場合_falseが返る() {
+    $_SERVER['HTTPS'] = 'off';
+    $this->expected = false;
+    $this->actual = SC_Utils::sfIsHTTPS();
+
+    $this->verify();
+  }
+
+  public function testSfIsHTTPS_環境変数に値が入っていない場合_falseが返る() {
+    unset($_SERVER['HTTPS']);
+    $this->expected = false;
+    $this->actual = SC_Utils::sfIsHTTPS();
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,75 @@
+<?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::sfMakeHiddenArray()のテストクラス.
+ * ※ソースコード上で使われている箇所がなく詳細仕様が不明なので、ソースコードに合わせて作成
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfMakeHiddenArrayest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfMakeHiddenArray__多段配列が1次元配列に変換される() {
+    $input_array = array(
+      'vegetable' => '野菜',
+      'fruit' => array(
+        'apple' => 'りんご',
+        'banana' => 'バナナ'
+      ),    
+      'drink' => array(
+         'alcohol' => array(
+           'beer' => 'ビール'
+         ),
+         'water' => '水'
+      ),
+      'rice' => '米'
+    );
+    $this->expected = array(
+      'vegetable' => '野菜',
+      'fruit[apple]' => 'りんご',
+      'fruit[banana]' => 'バナナ',
+      'drink[alcohol][beer]' => 'ビール',
+      'drink[water]' => '水',
+      'rice' => '米'
+    );
+    $this->actual = SC_Utils::sfMakeHiddenArray($input_array);
+    $this->verify();
+  }
+  //////////////////////////////////////////
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPassLenTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPassLenTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPassLenTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,65 @@
+<?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::sfPassLen()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_getSfPassLenTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfPassLen_入力が0の場合_0バイト文字列が返る() {
+    $input = '';
+    $this->expected = '';
+    $this->actual = SC_Utils::sfPassLen($input);
+
+    $this->verify();
+  }
+
+  public function testSfPassLen_入力が正の数の場合_入力と同じ文字数のアスタリスクが返る() {
+    $input = 17;
+    $this->expected = '*****************';
+    $this->actual = SC_Utils::sfPassLen($input);
+
+    $this->verify();
+  }
+
+  //////////////////////////////////////////
+
+}
+


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

追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfTrimURLTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfTrimURLTest.php	                        (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfTrimURLTest.php	2012-12-16 02:18:18 UTC (rev 22139)
@@ -0,0 +1,62 @@
+<?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::sfTrimURL()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfTrimURLTest extends Common_TestCase {
+
+
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  /////////////////////////////////////////
+  public function testSfTrimURL_URLがスラッシュで終わる場合_スラッシュが取り除かれる() {
+    $input = 'http://www.example.co.jp/';
+    $this->expected = 'http://www.example.co.jp';
+    $this->actual = SC_Utils::sfTrimURL($input);
+    $this->verify();
+  }
+
+  public function testSfTrimURL_URL末尾にスラッシュがない場合_文字列に変化がない() {
+    $input = 'http://www.example.co.jp';
+    $this->expected = $input;
+    $this->actual = SC_Utils::sfTrimURL($input);
+    $this->verify();
+  }
+  //////////////////////////////////////////
+
+}
+


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




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