本文整理汇总了PHP中runkit_constant_remove函数的典型用法代码示例。如果您正苦于以下问题:PHP runkit_constant_remove函数的具体用法?PHP runkit_constant_remove怎么用?PHP runkit_constant_remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了runkit_constant_remove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWhichCrlf
/**
* @using runkit pecl extension
* if not define PMA_USR_OS, then define it as Win
* if installed runkit, then constant will not change
*/
public function testWhichCrlf()
{
$runkit = function_exists('runkit_constant_redefine');
if ($runkit && defined('PMA_USR_OS')) {
$pma_usr_os = PMA_USR_OS;
}
if (defined('PMA_USR_OS') && !$runkit) {
if (PMA_USR_OS == 'Win') {
$this->assertEquals("\r\n", PMA_whichCrlf());
} else {
$this->assertEquals("\n", PMA_whichCrlf());
}
$this->markTestIncomplete('Cannot redefine constant');
} else {
if ($runkit) {
define('PMA_USR_OS', 'Linux');
$this->assertEquals("\n", PMA_whichCrlf());
}
if ($runkit) {
runkit_constant_redefine('PMA_USR_OS', 'Win');
} else {
define('PMA_USR_OS', 'Win');
}
$this->assertEquals("\r\n", PMA_whichCrlf());
}
if ($runkit) {
if (isset($pma_usr_os)) {
runkit_constant_redefine('PMA_USR_OS', 'Win');
} else {
runkit_constant_remove('PMA_USR_OS');
}
}
}
示例2: resetConstant
/**
* Reset original definition.
*/
public static function resetConstant($constant)
{
$originalConstant = "__ORIGINAL_{$constant}";
if (defined($originalConstant)) {
runkit_constant_redefine($constant, constant($originalConstant));
runkit_constant_remove($originalConstant);
}
}
示例3: tearDown
/**
* Tear down
*
* @return void
*/
public function tearDown()
{
//session_destroy();
// cleaning constants
if (PMA_HAS_RUNKIT) {
if ($this->oldSIDvalue != 'non-defined') {
runkit_constant_redefine('SID', $this->oldSIDvalue);
} elseif (defined('SID')) {
runkit_constant_remove('SID');
}
}
}
示例4: testWhichCrlf
/**
* Test for whichCrlf
*
* @return void
*
* @using runkit pecl extension
* if not define PMA_USR_OS, then define it as Win
* if installed runkit, then constant will not change
*/
public function testWhichCrlf()
{
if (PMA_HAS_RUNKIT && defined('PMA_USR_OS')) {
$pma_usr_os = PMA_USR_OS;
}
if (defined('PMA_USR_OS') && !PMA_HAS_RUNKIT) {
if (PMA_USR_OS == 'Win') {
$this->assertEquals("\r\n", PMA_Util::whichCrlf());
} else {
$this->assertEquals("\n", PMA_Util::whichCrlf());
}
$this->markTestIncomplete('Cannot redefine constant');
} else {
if (PMA_HAS_RUNKIT) {
if (!defined('PMA_USR_OS')) {
define('PMA_USR_OS', 'Linux');
} else {
runkit_constant_redefine('PMA_USR_OS', 'Linux');
}
$this->assertEquals("\n", PMA_Util::whichCrlf());
}
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine('PMA_USR_OS', 'Win');
} else {
define('PMA_USR_OS', 'Win');
}
$this->assertEquals("\r\n", PMA_Util::whichCrlf());
}
if (PMA_HAS_RUNKIT) {
if (isset($pma_usr_os)) {
runkit_constant_redefine('PMA_USR_OS', 'Win');
} else {
runkit_constant_remove('PMA_USR_OS');
}
}
}
示例5: testPMACheckConfigRw
/**
* Test for PMA_checkConfigRw
*
* @return void
*/
public function testPMACheckConfigRw()
{
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped('Cannot redefine constant');
}
$redefine = null;
$GLOBALS['cfg']['AvailableCharsets'] = array();
$GLOBALS['server'] = 0;
$GLOBALS['ConfigFile'] = new ConfigFile();
if (!defined('SETUP_CONFIG_FILE')) {
define('SETUP_CONFIG_FILE', 'test/test_data/configfile');
} else {
$redefine = 'SETUP_CONFIG_FILE';
runkit_constant_redefine('SETUP_CONFIG_FILE', 'test/test_data/configfile');
}
$is_readable = false;
$is_writable = false;
$file_exists = false;
PMA_checkConfigRw($is_readable, $is_writable, $file_exists);
$this->assertTrue($is_readable);
$this->assertTrue($is_writable);
$this->assertFalse($file_exists);
runkit_constant_redefine('SETUP_CONFIG_FILE', 'test/test_data/test.file');
PMA_checkConfigRw($is_readable, $is_writable, $file_exists);
$this->assertTrue($is_readable);
$this->assertTrue($is_writable);
$this->assertTrue($file_exists);
if ($redefine !== null) {
runkit_constant_redefine('SETUP_CONFIG_FILE', $redefine);
} else {
runkit_constant_remove('SETUP_CONFIG_FILE');
}
}
示例6: testAuthFails
/**
* Test for AuthenticationConfig::authFails
*
* @return void
*/
public function testAuthFails()
{
$removeConstant = false;
$GLOBALS['error_handler'] = new PMA_Error_Handler();
$GLOBALS['cfg']['Servers'] = array(1);
$GLOBALS['allowDeny_forbidden'] = false;
if (!defined('PMA_USR_BROWSER_AGENT')) {
define('PMA_USR_BROWSER_AGENT', 'chrome');
$removeConstant = true;
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped('Cannot remove constant');
}
}
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
$GLOBALS['dbi'] = $dbi;
ob_start();
$result = $this->object->authFails();
$html = ob_get_clean();
$this->assertTrue($result);
$this->assertContains('You probably did not create a configuration file. You might want ' . 'to use the <a href="setup/">setup script</a> to create one.', $html);
$this->assertContains('<strong>MySQL said: </strong><a href="./url.php?url=http%3A%2F%2F' . 'dev.mysql.com%2Fdoc%2Frefman%2F5.6%2Fen%2Ferror-messages-server.html"' . ' target="mysql_doc">' . '<img src="themes/dot.gif" title="Documentation" alt="Documentation" ' . 'class="icon ic_b_help" /></a>', $html);
$this->assertContains('Cannot connect: invalid settings.', $html);
$this->assertContains('<a href="index.php?server=0&lang=en' . '&collation_connection=utf-8&token=token" ' . 'class="button disableAjax">Retry to connect</a>', $html);
if ($removeConstant) {
runkit_constant_remove('PMA_USR_BROWSER_AGENT');
}
}
示例7: tearDown
public function tearDown()
{
//session_destroy();
// cleaning constants
if ($this->runkitExt) {
if ($this->oldIISvalue != 'non-defined') {
runkit_constant_redefine('PMA_IS_IIS', $this->oldIISvalue);
} elseif (defined('PMA_IS_IIS')) {
runkit_constant_remove('PMA_IS_IIS');
}
if ($this->oldSIDvalue != 'non-defined') {
runkit_constant_redefine('SID', $this->oldSIDvalue);
} elseif (defined('SID')) {
runkit_constant_remove('SID');
}
}
if ($this->apdExt) {
unset($GLOBALS['header']);
}
}
示例8: testUserprefsRedirect
/**
* Test for PMA_userprefsRedirect
*
* @return void
*/
public function testUserprefsRedirect()
{
if (!defined('PMA_TEST_HEADERS')) {
$this->markTestSkipped('Cannot redefine constant/function - missing runkit extension');
}
$GLOBALS['PMA_Config']->set('PmaAbsoluteUri', '');
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['lang'] = '';
$redefine = null;
if (!defined('PMA_IS_IIS')) {
define('PMA_IS_IIS', false);
} else {
$redefine = PMA_IS_IIS;
runkit_constant_redefine('PMA_IS_IIS', false);
}
PMA_userprefsRedirect('file.html', array('a' => 'b'), 'h ash');
$this->assertContains('Location: /phpmyadmin/file.html?a=b&saved=1&server=0#h+ash', $GLOBALS['header'][0]);
if ($redefine !== null) {
runkit_constant_redefine('PMA_IS_IIS', $redefine);
} else {
runkit_constant_remove('PMA_IS_IIS');
}
}
示例9: testDisplayFieldsetBottom
/**
* Test for PMA_displayFieldsetBottom()
*
* @return void
*/
public function testDisplayFieldsetBottom()
{
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped('Cannot modify constant');
}
// with PMA_SETUP
if (!defined('PMA_SETUP')) {
define('PMA_SETUP', true);
}
$result = PMA_displayFieldsetBottom();
$this->assertContains('<td colspan="3" class="lastrow">', $result);
$this->assertContains('<input type="submit" name="submit_save" value="Apply"', $result);
$this->assertContains('<input type="button" name="submit_reset" value="Reset" />', $result);
$this->assertContains('</fieldset>', $result);
// without PMA_SETUP
runkit_constant_remove('PMA_SETUP');
$result = PMA_displayFieldsetBottom();
$this->assertContains('<td colspan="2" class="lastrow">', $result);
}
示例10: undefineConstant
public static function undefineConstant($className, $constName)
{
$runkitName = ($className === null ? "" : $className . "::") . $constName;
yTest_debugCC("undefineConstant {$runkitName}");
$res = runkit_constant_remove($runkitName);
yTest_assert($res);
}
示例11: testGetDbCollation
/**
* Test for PMA_getDbCollation
*
* @return void
* @test
*/
public function testGetDbCollation()
{
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped('Cannot redefine constant - missing runkit extension');
} else {
$GLOBALS['server'] = 1;
// test case for system schema
$this->assertEquals('utf8_general_ci', PMA_getDbCollation("information_schema"));
$restoreDrizzle = '';
// test case with no pma drizzle
if (defined('PMA_DRIZZLE')) {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
} else {
$restoreDrizzle = 'PMA_TEST_CONSTANT_REMOVE';
define('PMA_DRIZZLE', false);
}
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['DBG']['sql'] = false;
$this->assertEquals('utf8_general_ci', PMA_getDbCollation('pma_test'));
// test case with pma drizzle as true
runkit_constant_redefine('PMA_DRIZZLE', true);
$this->assertEquals('utf8_general_ci_pma_drizzle', PMA_getDbCollation('pma_test'));
$GLOBALS['cfg']['Server']['DisableIS'] = true;
$GLOBALS['db'] = 'pma_test2';
$this->assertEquals('bar', PMA_getDbCollation('pma_test'));
$this->assertNotEquals('pma_test', $GLOBALS['dummy_db']);
if ($restoreDrizzle === 'PMA_TEST_CONSTANT_REMOVE') {
runkit_constant_remove('PMA_DRIZZLE');
} else {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
}
示例12: testAuthCheckWithConstants
/**
* Test for AuthenticationConfig::authCheck with constant modifications
*
* @return void
*/
public function testAuthCheckWithConstants()
{
if (!defined('PMA_CLEAR_COOKIES') && !PMA_HAS_RUNKIT) {
$this->markTestSkipped('Cannot redefine constant/function - missing runkit extension');
}
$remove = false;
if (!defined('PMA_CLEAR_COOKIES')) {
define('PMA_CLEAR_COOKIES', true);
$remove = true;
}
$GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey';
$GLOBALS['cfg']['Servers'] = array(1);
$_COOKIE['pmaPass-0'] = 1;
$_COOKIE['pmaServer-0'] = 1;
$_COOKIE['pmaUser-0'] = 1;
$this->assertFalse($this->object->authCheck());
$this->assertFalse(isset($_COOKIE['pmaPass-0']));
$this->assertFalse(isset($_COOKIE['pmaServer-0']));
$this->assertFalse(isset($_COOKIE['pmaUser-0']));
if ($remove) {
runkit_constant_remove('PMA_CLEAR_COOKIES');
}
}
示例13: do_debug_mode
/**
* do debug mode
*/
public static function do_debug_mode()
{
//turn off/on debug mode
if (hw_option('debug') && (!defined('WP_DEBUG') || !WP_DEBUG)) {
if (function_exists('runkit_constant_remove') && defined('WP_DEBUG')) {
runkit_constant_remove("WP_DEBUG");
}
if (!defined('WP_DEBUG')) {
define("WP_DEBUG", true);
}
//turn debug
}
if (defined('WP_DEBUG') && WP_DEBUG) {
if (function_exists('runkit_constant_remove') && defined('WP_DEBUG')) {
runkit_constant_remove("WP_DEBUG");
}
if (!defined('WP_DEBUG')) {
define("WP_DEBUG", false);
}
}
}
示例14: removeConstant
/**
* @param string $name
*
* @return boolean
*/
public function removeConstant($name)
{
if (!function_exists('runkit_constant_remove')) {
return false;
}
return runkit_constant_remove($name);
}
示例15: redefine_mailchimp_capability
function redefine_mailchimp_capability()
{
runkit_constant_remove('MCSF_CAP_THRESHOLD');
define('MCSF_CAP_THRESHOLD', 'mailchimp_options');
}