本文整理汇总了PHP中Zend_Session::_unitTestEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::_unitTestEnabled方法的具体用法?PHP Zend_Session::_unitTestEnabled怎么用?PHP Zend_Session::_unitTestEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::_unitTestEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFramework
/**
* init the test framework
*/
public function initFramework()
{
$this->setWhiteAndBlacklists();
// get config
$configData = @(include 'phpunitconfig.inc.php');
if ($configData === false) {
$configData = (include 'config.inc.php');
}
if ($configData === false) {
die('central configuration file config.inc.php not found in includepath: ' . get_include_path());
}
$config = new Zend_Config($configData);
Zend_Registry::set('testConfig', $config);
$_SERVER['DOCUMENT_ROOT'] = $config->docroot;
$_SERVER['REQUEST_URI'] = '';
Tinebase_Core::startCoreSession();
Tinebase_Core::initFramework();
// set default test mailer
Tinebase_Smtp::setDefaultTransport(new Zend_Mail_Transport_Array());
// set max execution time
Tinebase_Core::setExecutionLifeTime(1200);
if ($config->locale) {
Tinebase_Core::setupUserLocale($config->locale);
}
// this is needed for session handling in unittests (deactivate Zend_Session::writeClose and others)
Zend_Session::$_unitTestEnabled = TRUE;
}
示例2: setUp
public function setUp()
{
$options = array('env' => 'testing', 'resources' => array('Cache', 'Config', 'Path', 'Session'));
$path = GENE_APP_PATH;
Gene::app($path, $options);
Zend_Session::$_unitTestEnabled = true;
}
示例3: testAccountBlocking
/**
* @group ServerTests
*/
public function testAccountBlocking()
{
Zend_Session::$_unitTestEnabled = true;
$request = \Zend\Http\PhpEnvironment\Request::fromString(<<<EOS
POST /index.php HTTP/1.1
Content-Type: application/json
Content-Length: 122
Host: 192.168.122.158
Connection: keep-alive
Origin: http://192.168.1.158
X-Tine20-Request-Type: JSON
X-Tine20-Jsonkey: undefined
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36
X-Tine20-Transactionid: 9c7129898e9f8ab7e4621fddf7077a1eaa425aac
X-Requested-With: XMLHttpRequest
Accept: */*
Referer: http://192.168.122.158/tine20dev/
Accept-Encoding: gzip,deflate
Accept-Language: de-DE,de;q=0.8,en-GB;q=0.6,en;q=0.4
EOS
);
$credentials = $this->getTestCredentials();
$maxLoginFailures = Tinebase_Config::getInstance()->get(Tinebase_Config::MAX_LOGIN_FAILURES, 5);
for ($i = 0; $i <= $maxLoginFailures; $i++) {
$result = Tinebase_Controller::getInstance()->login($credentials['username'], 'foobar', $request);
$this->assertFalse($result);
}
// account must be blocked now
$result = Tinebase_Controller::getInstance()->login($credentials['username'], $credentials['password'], $request);
$this->assertFalse($result);
}
示例4: setUp
protected function setUp()
{
$this->_frontController = System_Application::getInstance()->getBootstrap()->getResource('FrontController');
$this->frontController->setParam('bootstrap', System_Application::getInstance()->getBootstrap());
$this->getRequest()->setBaseUrl($this->frontController->getBaseUrl());
Zend_Session::$_unitTestEnabled = true;
}
示例5: tearDown
/**
* tear down tests
*/
protected function tearDown()
{
Zend_Session::$_unitTestEnabled = false;
if ($this->_transactionId) {
Tinebase_TransactionManager::getInstance()->rollBack();
}
}
示例6: testInitSetsSaveHandler
public function testInitSetsSaveHandler()
{
Zend_Session::$_unitTestEnabled = true;
$saveHandler = $this->getMock('Zend_Session_SaveHandler_Interface');
$this->resource->setSaveHandler($saveHandler);
$this->resource->init();
$this->assertSame($saveHandler, Zend_Session::getSaveHandler());
}
示例7: setUp
protected function setUp()
{
\Zend_Controller_Front::getInstance()->resetInstance();
$this->request = new \Zend_Controller_Request_Http();
\Zend_Session::$_unitTestEnabled = true;
$this->acl = new \Zend_Acl();
$this->acl->deny();
$this->acl->addRole(new \Zend_Acl_Role(Acl::ROLE_GUEST));
$this->acl->addRole(new \Zend_Acl_Role(Acl::ROLE_AUTHENTICATED), Acl::ROLE_GUEST);
parent::setUp();
}
示例8: testShouldNotAuthNoExistingUserAndReturnErrorCode
public function testShouldNotAuthNoExistingUserAndReturnErrorCode()
{
//GIVEN
Zend_Session::$_unitTestEnabled = true;
$oApiUser = new AM_Api_User();
//WHEN
$aResult = $oApiUser->login('no-existing-user', 'password');
//THEN
$aExpectedResult = array('code' => Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, 'messages' => array('A record with the supplied identity could not be found.'));
$this->assertEquals($aExpectedResult, $aResult);
}
示例9: setUp
static function setUp()
{
set_include_path(implode(PATH_SEPARATOR, array(realpath(dirname(__FILE__) . '/../application'), realpath(dirname(__FILE__) . '/../library'), get_include_path())));
require_once realpath(dirname(__FILE__) . '/../application/Bootstrap.php');
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
self::$bootstrap = new Bootstrap(getenv('APPLICATION_ENV'));
Zend_Session::$_unitTestEnabled = true;
Zend_Loader::loadClass('Sql');
$sql = new Sql();
$sql->reset();
}
示例10: setUp
protected function setUp()
{
parent::setUp();
$this->rediska->set('user_ids:test', 1);
$data = new stdClass();
$data->login = 'test';
$data->password = 'test';
$this->rediska->set('users:1', $data);
Zend_Session::$_unitTestEnabled = true;
$this->auth = Zend_Auth::getInstance();
$this->adapter = new Rediska_Zend_Auth_Adapter_Redis();
}
示例11: setUpBeforeClass
public static function setUpBeforeClass()
{
require_once 'var/Test/ServiceMock.php';
require_once 'var/Test/BeforeHookMock.php';
require_once 'var/Test/AfterHookMock.php';
require_once 'var/Test/Validator.php';
$iniPath = GENE_TEST_ROOT . '/var/config/database.ini';
$file = GENE_TEST_ROOT . '/var/sql/create.sql';
Gene_TestHelper::trancate($iniPath, $file, 'production');
$options = array('env' => 'testing', 'resources' => array('Cache', 'Config', 'Path', 'Db'));
$path = GENE_APP_PATH;
Gene::app($path, $options);
Zend_Session::$_unitTestEnabled = true;
}
示例12: _init
protected function _init($componentClass)
{
Kwf_Component_Data_Root::setComponentClass($componentClass);
Zend_Session::$_unitTestEnabled = true;
$this->_root = Kwf_Component_Data_Root::getInstance();
$this->_root->setFilename('kwf/kwctest/' . $componentClass);
if (function_exists('apc_clear_cache')) {
apc_clear_cache('user');
}
Kwf_Component_Cache_Memory::getInstance()->_clean();
Kwf_Cache_Simple::resetZendCache();
Kwc_FulltextSearch_MetaModel::setInstance(new Kwf_Model_FnF(array('primaryKey' => 'page_id')));
Kwf_Assets_Package_Default::clearInstances();
Kwf_Component_LogDuplicateModel::setInstance(new Kwf_Model_FnF(array()));
Kwf_Media_MemoryCache::getInstance()->clean();
return $this->_root;
}
示例13: tearDown
/**
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
*
* @return void
*/
public function tearDown()
{
$registry = Zend_Registry::getInstance();
if (isset($registry['router'])) {
unset($registry['router']);
}
if (isset($registry['dispatcher'])) {
unset($registry['dispatcher']);
}
if (isset($registry['plugin'])) {
unset($registry['plugin']);
}
if (isset($registry['viewRenderer'])) {
unset($registry['viewRenderer']);
}
Zend_Session::$_unitTestEnabled = false;
session_id(uniqid());
}
示例14: setUp
/**
* Set up the test case
*/
public function setUp()
{
parent::setUp();
$dir = Enlight_TestHelper::Instance()->TestPath('TempFiles');
$this->db = Enlight_Components_Db::factory('PDO_SQLITE', array('dbname' => Enlight_TestHelper::Instance()->TestPath('TempFiles') . 'auth.db'));
$this->lockeduntilColumn = 'lockeduntil';
$this->createDb($this->lockeduntilColumn);
$this->createDefaultUser($this->lockeduntilColumn);
// Needed to simulate web environment - otherwise we would get a nasty notice.
$GLOBALS['_SESSION'] = array();
Zend_Session::$_unitTestEnabled = true;
Zend_Session::start();
$this->auth = Enlight_Components_Auth::getInstance();
$this->authAdapter = new Enlight_Components_Auth_Adapter_DbTable($this->db, 'test_auth', 'username', 'password');
$this->authAdapter->setIdentityColumn('username')->setCredentialColumn('password')->setExpiryColumn('lastlogin')->setSessionIdColumn('sessionID')->setSessionId('s4inr04o6apmclk7u88qau4r57');
$storage = new Zend_Auth_Storage_Session('Enlight', 'Auth');
$this->auth->setAdapter($this->authAdapter);
$this->assertInstanceOf('Enlight_Components_Auth_Adapter_DbTable', $this->auth->getAdapter());
$this->auth->setStorage($storage);
}
示例15: initFramework
/**
* init the test framework
*/
public function initFramework()
{
$this->setWhiteAndBlacklists();
$config = $this->getConfig();
// set some server vars. sabredav complains if REQUEST_URI is not set
$_SERVER['DOCUMENT_ROOT'] = $config->docroot;
$_SERVER['REQUEST_URI'] = '';
Tinebase_Core::startCoreSession();
Tinebase_Core::initFramework();
// set default test mailer
Tinebase_Smtp::setDefaultTransport(new Zend_Mail_Transport_Array());
// set max execution time
Tinebase_Core::setExecutionLifeTime(1200);
if ($config->locale) {
Tinebase_Core::setupUserLocale($config->locale);
}
// this is needed for session handling in unittests (deactivate Zend_Session::writeClose and others)
Zend_Session::$_unitTestEnabled = TRUE;
Tinebase_Core::set('frameworkInitialized', true);
}