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

Revision 22796, 1.7 KB checked in by h_yoshimoto, 11 years ago (diff)

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

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.