source: branches/version-2_12-dev/tests/class/test/util/Test_Utils.php @ 22139

Revision 22139, 1.6 KB checked in by shift_hiroko.tamagawa, 10 years ago (diff)

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

  • Property svn:keywords set to Id Rev Date
Line 
1<?php
2
3/*
4 * This file is part of EC-CUBE
5 *
6 * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
7 *
8 * http://www.lockon.co.jp/
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23 */
24
25/**
26 * テストケースで使う一般的なユーティリティを持つクラス.
27 *
28 * @author Hiroko Tamagawa
29 * @version $Id$
30 */
31class Test_Utils {
32
33  /**
34   * 連想配列から指定されたキーだけを抜き出したものを返します.
35   * 入力の連想配列には変更を加えません.
36   *
37   * @static
38   * @param input_array 入力の連想配列
39   * @param map_keys 出力結果に入れたいキーを配列で指定します
40   * @return 指定したキーのみを持つ連想配列
41   */
42  public static function mapArray($input_array, $map_keys) {
43    $output_array = array();
44    foreach ($map_keys as $index => $map_key) {
45      $output_array[$map_key] = $input_array[$map_key];
46    }
47
48    return $output_array;
49  }
50
51}
52
Note: See TracBrowser for help on using the repository browser.