本文整理汇总了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();
}
示例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');
}
示例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');
}
示例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) {
示例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"
}'));
}