本文整理汇总了PHP中Civi::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Civi::reset方法的具体用法?PHP Civi::reset怎么用?PHP Civi::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Civi
的用法示例。
在下文中一共展示了Civi::reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
parent::tearDown();
\Civi::reset();
}
示例2: tearDown
protected function tearDown()
{
parent::tearDown();
$this->cleanupFiles();
\Civi::reset();
}
示例3: setUp
/**
* Common setup functions for all unit tests.
*/
protected function setUp()
{
$session = CRM_Core_Session::singleton();
$session->set('userID', NULL);
$this->errorScope = CRM_Core_TemporaryErrorScope::useException();
// REVERT
// Use a temporary file for STDIN
$GLOBALS['stdin'] = tmpfile();
if ($GLOBALS['stdin'] === FALSE) {
echo "Couldn't open temporary file\n";
exit(1);
}
// Get and save a connection to the database
$this->_dbconn = $this->getConnection();
// reload database before each test
// $this->_populateDB();
// "initialize" CiviCRM to avoid problems when running single tests
// FIXME: look at it closer in second stage
$GLOBALS['civicrm_setting']['domain']['fatalErrorHandler'] = 'CiviUnitTestCase_fatalErrorHandler';
$GLOBALS['civicrm_setting']['domain']['backtrace'] = 1;
// disable any left-over test extensions
CRM_Core_DAO::executeQuery('DELETE FROM civicrm_extension WHERE full_name LIKE "test.%"');
// reset all the caches
CRM_Utils_System::flushCache();
// initialize the object once db is loaded
\Civi::reset();
$config = CRM_Core_Config::singleton(TRUE, TRUE);
// ugh, performance
// when running unit tests, use mockup user framework
$this->hookClass = CRM_Utils_Hook::singleton();
// Make sure the DB connection is setup properly
$config->userSystem->setMySQLTimeZone();
$env = new CRM_Utils_Check_Component_Env();
CRM_Utils_Check::singleton()->assertValid($env->checkMysqlTime());
// clear permissions stub to not check permissions
$config->userPermissionClass->permissions = NULL;
//flush component settings
CRM_Core_Component::getEnabledComponents(TRUE);
error_reporting(E_ALL);
$this->_sethtmlGlobals();
}
示例4: bootHeadless
/**
* @param HeadlessInterface|\PHPUnit_Framework_Test $test
*/
protected function bootHeadless($test)
{
if (CIVICRM_UF !== 'UnitTests') {
throw new \RuntimeException('HeadlessInterface requires CIVICRM_UF=UnitTests');
}
// Hrm, this seems wrong. Shouldn't we be resetting the entire session?
$session = \CRM_Core_Session::singleton();
$session->set('userID', NULL);
$test->setUpHeadless();
$config = \CRM_Core_Config::singleton(TRUE, TRUE);
// ugh, performance
\CRM_Utils_System::flushCache();
\Civi::reset();
\CRM_Core_Session::singleton()->set('userID', NULL);
if (property_exists($config->userPermissionClass, 'permissions')) {
$config->userPermissionClass->permissions = NULL;
}
}