当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::setData方法代码示例

本文整理汇总了PHP中Terminus\Session::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::setData方法的具体用法?PHP Session::setData怎么用?PHP Session::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Terminus\Session的用法示例。


在下文中一共展示了Session::setData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetData

 public function testSetData()
 {
     $this->assertFalse($this->session->setData([]));
     $proverb[] = 'Be humble for you are made of earth. ';
     $proverb[] = 'Be noble for you are made of stars.';
     $this->assertTrue(Session::setData($proverb));
     $data = (array) Session::getData();
     $this->assertEquals(array_pop($data), $proverb[1]);
     setDummyCredentials();
 }
开发者ID:karudonaldson,项目名称:terminus,代码行数:10,代码来源:test-session.php

示例2: dirname

<?php

/**
 * Bootstrap file for unit tests
 */
define('CLI_ROOT', dirname(__DIR__) . '/..');
define('TEST_DIR', dirname(__DIR__));
define('TERMINUS_CMD', 'php ' . CLI_ROOT . '/php/boot-fs.php');
putenv('CLI_TEST_MODE=1');
require_once CLI_ROOT . '/vendor/autoload.php';
require_once CLI_ROOT . '/php/boot-fs.php';
Terminus::set_config('nocache', true);
Terminus::set_config('debug', false);
use Terminus\Session;
// Set some dummy credentials
Session::setData(json_decode('{
  "user_uuid": "0ffec038-4410-43d0-a404-46997f672d7a",
  "session": "0ffec038-4410-43d0-a404-46997f672d7a%3A68486878-dd87-11e4-b243-bc764e1113b5%3AbQR2fyNMh5PQXN6F2Ewge",
  "session_expire_time": 1739299351,
  "email": "bensheldon+pantheontest@gmail.com"
}'));
\VCR\VCR::configure()->enableRequestMatchers(array('method', 'url', 'body'));
# Prevent API requests from being made in CI Environment
$ci_environment = getenv('CI');
if ($ci_environment) {
    \VCR\VCR::configure()->setMode('none');
}
开发者ID:reynoldsalec,项目名称:cli,代码行数:27,代码来源:bootstrap.php

示例3: dirname

<?php

/**
 * Bootstrap file for unit tests
 */
unset($GLOBALS['argv']);
define('CLI_ROOT', dirname(__DIR__) . '/..');
define('TEST_DIR', dirname(__DIR__));
define('TERMINUS_CMD', 'php ' . CLI_ROOT . '/php/boot-fs.php');
putenv('CLI_TEST_MODE=1');
require_once CLI_ROOT . '/vendor/autoload.php';
require_once CLI_ROOT . '/php/boot-fs.php';
Terminus::setConfig('debug', false);
use Terminus\Session;
$session_id = '0ffec038-4410-43d0-a404-46997f672d7a%3A68486878';
$session_id .= '-dd87-11e4-b243-bc764e1113b5%3AbQR2fyNMh5PQXN6F2Ewge';
// Set some dummy credentials
Session::setData(json_decode('{
      "user_uuid": "0ffec038-4410-43d0-a404-46997f672d7a",
      "session": "' . $session_id . '",
      "session_expire_time": 1739299351,
      "email": "bensheldon+pantheontest@gmail.com"
    }'));
\VCR\VCR::configure()->enableRequestMatchers(array('method', 'url', 'body'));
// Prevent API requests from being made in CI Environment
$ci_environment = getenv('CI');
if ($ci_environment) {
    \VCR\VCR::configure()->setMode('none');
}
开发者ID:Zacker,项目名称:cli,代码行数:29,代码来源:bootstrap.php

示例4: custom_terminus_match_headers

/**
 * Bootstrap file for unit tests
 */
define('CLI_ROOT', dirname(__DIR__));
define('TERMINUS_CMD', 'php ' . CLI_ROOT . '/php/boot-fs.php');
putenv('CLI_TEST_MODE=1');
require_once CLI_ROOT . '/php/boot-fs.php';
Terminus::set_config('nocache', TRUE);
Terminus::set_config('debug', false);
use Terminus\Fixtures;
use Terminus\Session;
// Set some dummy credentials
Session::setData(json_decode('{
    "user_uuid": "dca4f8cd-9ec2-4117-957f-fc5230c23737",
    "session": "dca4f8cd-9ec2-4117-957f-fc5230c23737:20e4ceb0-b224-11e4-94f5-bc764e111d20:jakuWJ8hw4PGMq9Plm9wk",
    "session_expire_time": 1739299351,
    "email": "mike+test@mikevanwinkle.com"
}'));
/**
 * Modified match function to replace VCR\RequestMatcher::matchHeaders() Returns true if the headers of both specified requests match.
 *
 * @param  Request $first  First request to match.
 * @param  Request $second Second request to match.
 *
 * @return boolean True if the headers of both specified requests match.
 */
\VCR\VCR::configure()->addRequestMatcher('headers', 'custom_terminus_match_headers');
function custom_terminus_match_headers($first, $second)
{
    $firstHeaders = $first->getHeaders();
    foreach ($second->getHeaders() as $key => $pattern) {
开发者ID:mikevanwinkle,项目名称:cli,代码行数:31,代码来源:bootstrap.php

示例5: setDummyCredentials

/**
 * Sets some dummy credentials for this test run
 *
 * @return void
 */
function setDummyCredentials()
{
    $session_id = '0ffec038-4410-43d0-a404-46997f672d7a%3A68486878';
    $session_id .= '-dd87-11e4-b243-bc764e1113b5%3AbQR2fyNMh5PQXN6F2Ewge';
    // Set some dummy credentials
    Session::setData(json_decode('{
        "user_uuid": "0ffec038-4410-43d0-a404-46997f672d7a",
        "session": "' . $session_id . '",
        "session_expire_time": ' . strtotime('+8 days') . ',
        "email": "bensheldon+pantheontest@gmail.com"
      }'));
}
开发者ID:sammys,项目名称:terminus,代码行数:17,代码来源:bootstrap.php


注:本文中的Terminus\Session::setData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。