source: branches/version-2_12-multilang/tests/class/test/util/User_Utils.php @ 22278

Revision 22278, 1.7 KB checked in by m_uehara, 11 years ago (diff)

#1955 r22097 - r22098 , r22104 - r22107 , r22111 - r22120 , r22123 - r22129 , r22133 , r22135 - r22143 , r22145 - r22146 , r22158 , r22164 - r22165 , r22167 - r22169 , r22187 - r22196 , r22199 - r22204, r22219 - r22261 間のコミットをマージします。

Line 
1<?php
2
3/**
4 * ユーザの状態をテストに合わせて変化させるユーティリティクラスです。
5 *
6 */
7class User_Utils {
8
9  /**
10   * 端末種別を設定します。
11   *
12   * @static
13   * @param deviceType  端末種別ID
14   */
15  public static function setDeviceType($deviceType) {
16    SC_Display_Ex::setDummyDevice($deviceType);
17  }
18
19  /**
20   * ログイン状態を設定します。
21   *
22   * @static
23   * @param isLogin true:ログインしている、false:ログインしていない
24   */
25  public static function setLoginState($isLogin, $customer = null, $objQuery = null) {
26    if (!$isLogin) {
27      $_SESSION['customer']['customer_id'] = null;
28      $_SESSION['customer']['email'] = null;
29      return;
30    }
31    $customer = array_merge(self::getDefaultCustomer(), $customer);
32    $_SESSION['customer']['customer_id'] = $customer['customer_id'];
33    $_SESSION['customer']['email'] = $customer['email'];
34    $objQuery->delete('dtb_customer', 'customer_id = ?', array($customer['customer_id']));
35    $objQuery->insert('dtb_customer', $customer);
36  }
37
38  /**
39   * ユーザ情報を外部から設定しなかった場合のデフォルト値を取得します。
40   */
41  private static function getDefaultCustomer() {
42    $arrValue['customer_id'] = '999999998';
43    $arrValue['name01'] = '苗字';
44    $arrValue['name02'] = '名前';
45    $arrValue['kana01'] = 'みょうじ';
46    $arrValue['kana02'] = 'なまえ';
47    $arrValue['email'] = 'sample@sample.co.jp';
48    $arrValue['secret_key'] = 'aaaaaa';
49    $arrValue['status'] = 2;
50    $arrValue['create_date'] = 'CURRENT_TIMESTAMP';
51    $arrValue['update_date'] = 'CURRENT_TIMESTAMP';
52
53    return $arrValue;
54  }
55}
56
Note: See TracBrowser for help on using the repository browser.