[Svn-src-all:3244] [version-2_12-dev 22145] #1978 テスト用ユーティリティを追加

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


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

Log:
--------------------------------------------------------
#1978 テスト用ユーティリティを追加

Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
U   branches/version-2_12-dev/tests/class/test/util/Test_Utils.php
U   branches/version-2_12-dev/tests/class/test/util/User_Utils.php

変更: branches/version-2_12-dev/tests/class/test/util/Test_Utils.php
===================================================================
--- branches/version-2_12-dev/tests/class/test/util/Test_Utils.php	2012-12-17 05:25:58 UTC (rev 22144)
+++ branches/version-2_12-dev/tests/class/test/util/Test_Utils.php	2012-12-17 07:12:05 UTC (rev 22145)
@@ -48,5 +48,22 @@
     return $output_array;
   }
 
+  /**
+   * 配列の各要素(連想配列)から特定のキーだけを抜き出した配列を返します.
+   * 入力の連想配列には変更を加えません.
+   * 
+   * @static
+   * @param input_array 入力の配列
+   * @param key 抽出対象のキー
+   * @return 指定のキーだけを抜き出した配列
+   */
+  public static function mapCols($input_array, $key) {
+    $output_array = array();
+    foreach ($input_array as $data) {
+      $output_array[] = $data[$key];
+    }
+    
+    return $output_array;
+  }
 }
 

変更: branches/version-2_12-dev/tests/class/test/util/User_Utils.php
===================================================================
--- branches/version-2_12-dev/tests/class/test/util/User_Utils.php	2012-12-17 05:25:58 UTC (rev 22144)
+++ branches/version-2_12-dev/tests/class/test/util/User_Utils.php	2012-12-17 07:12:05 UTC (rev 22145)
@@ -28,9 +28,7 @@
       $_SESSION['customer']['email'] = null;
       return;
     }
-    if ($customer == null) {
-      $customer = self::getDefaultCustomer();
-    }
+    $customer = array_merge(self::getDefaultCustomer(), $customer);
     $_SESSION['customer']['customer_id'] = $customer['customer_id'];
     $_SESSION['customer']['email'] = $customer['email'];
     $objQuery->insert('dtb_customer', $customer);




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