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


PHP runkit_function_rename函数代码示例

本文整理汇总了PHP中runkit_function_rename函数的典型用法代码示例。如果您正苦于以下问题:PHP runkit_function_rename函数的具体用法?PHP runkit_function_rename怎么用?PHP runkit_function_rename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: plugin_wix_init

function plugin_wix_init()
{
    define('PatternFile', dirname(__FILE__) . '/WixPattern.txt');
    require_once $_SERVER['DOCUMENT_ROOT'] . '/wix_cms_newbody.php';
    runkit_function_rename('catbody', 'old_catbody');
    runkit_function_rename('new_catbody', 'catbody');
}
开发者ID:Tom39,项目名称:pukiwiki,代码行数:7,代码来源:wix.inc.php

示例2: teardown

 function teardown()
 {
     runkit_function_rename('unslash', 'html_hilight_test_unslash');
     if (function_exists('html_hilight_test_unslash_real')) {
         runkit_function_rename('html_hilight_test_unslash_real', 'unslash');
     }
 }
开发者ID:stretchyboy,项目名称:dokuwiki,代码行数:7,代码来源:html_hilight.test.php

示例3: getMock

 public function getMock()
 {
     $mock = $this->testCase->getMock('stdClass', $this->functions, array(), 'PHPUnit_Extension_FunctionMocker_' . uniqid());
     foreach ($this->functions as $function) {
         $fqFunction = $this->namespace . '\\' . $function;
         if (in_array($fqFunction, static::$mockedFunctions, true)) {
             continue;
         }
         if (!extension_loaded('runkit') || !ini_get('runkit.internal_override')) {
             PHPUnit_Extension_FunctionMocker_CodeGenerator::defineFunction($function, $this->namespace);
         } elseif (!function_exists('__phpunit_function_mocker_' . $function)) {
             runkit_function_rename($function, '__phpunit_function_mocker_' . $function);
             error_log($function);
             runkit_method_redefine($function, function () use($function) {
                 if (!isset($GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'][$this->namespace])) {
                     return call_user_func_array('__phpunit_function_mocker_' . $function, func_get_args());
                 }
                 return call_user_func_array(array($GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'][$this->namespace], $function), func_get_args());
             });
             var_dump(strlen("foo"));
         }
         static::$mockedFunctions[] = $fqFunction;
     }
     if (!isset($GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'])) {
         $GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'] = array();
     }
     $GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'][$this->namespace] = $mock;
     return $mock;
 }
开发者ID:Dossar,项目名称:boltbse,代码行数:29,代码来源:FunctionMocker.php

示例4: teardown

 function teardown()
 {
     global $conf;
     // restore purge
     if (is_null($this->purge)) {
         unset($_REQUEST['purge']);
     } else {
         $_REQUEST['purge'] = $this->purge;
     }
     // restore $conf['cachedir'] if necessary
     if (!$this->cachedir) {
         unset($conf['cachedir']);
     }
     // restore io_functions
     runkit_function_rename('io_makefiledir', 'xhtml_htmlphp_test_io_makefiledir');
     if (function_exists('io_makefiledir_real')) {
         runkit_function_rename('io_makefiledir_real', 'io_makefiledir');
     }
     runkit_function_rename('io_savefile', 'xhtml_htmlphp_test_io_savefile');
     if (function_exists('io_savefile_real')) {
         runkit_function_rename('io_savefile_real', 'io_savefile');
     }
     // restore GeSHi::parse_code
     runkit_method_remove('GeSHi', 'parse_code');
     runkit_method_rename('GeSHi', 'parse_code_real', 'parse_code');
     parent::setup();
 }
开发者ID:pyfun,项目名称:dokuwiki,代码行数:27,代码来源:xhtml_htmlphp.test.php

示例5: resetFunction

 /**
  *	Reset original function.
  */
 public static function resetFunction($function)
 {
     $originalFunction = "__original_{$function}";
     if (function_exists($originalFunction)) {
         runkit_function_remove($function);
         runkit_function_rename($originalFunction, $function);
     }
 }
开发者ID:v-technologies,项目名称:transformist,代码行数:11,代码来源:Runkit.php

示例6: disable

 /**
  * Disable
  *
  * @return \MockFunction
  */
 public function disable()
 {
     if ($this->active) {
         $this->active = false;
         runkit_function_remove($this->functionName);
         runkit_function_rename($this->functionAlias, $this->functionName);
     }
     return $this;
 }
开发者ID:qubit05,项目名称:phpunit-mockfunction,代码行数:14,代码来源:MockFunction.php

示例7: restore

 /**
  * Restore
  *
  * @return \MockFunction
  */
 public function restore()
 {
     if (!$this->_mock) {
         return $this;
     }
     $this->_mock = false;
     runkit_function_remove($this->_function_name);
     runkit_function_rename($this->_function_alias, $this->_function_name);
     return $this;
 }
开发者ID:lancerhe,项目名称:phpunit-mock,代码行数:15,代码来源:MockFunction.php

示例8: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     if (self::$skipped) {
         return;
     }
     runkit_function_rename('pinba_timer_start', 'pinba_timer_start_callback');
     runkit_function_rename('pinba_timer_stop', 'pinba_timer_stop_callback');
     runkit_function_rename('pinba_timer_start_bak', 'pinba_timer_start');
     runkit_function_rename('pinba_timer_stop_bak', 'pinba_timer_stop');
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:10,代码来源:PinbaTest.class.php

示例9: tearDown

 public function tearDown()
 {
     if (function_exists('TEST_SAVED_file_get_contents')) {
         runkit_function_remove('file_get_contents');
         runkit_function_rename('TEST_SAVED_file_get_contents', 'file_get_contents');
     }
     if (function_exists('TEST_SAVED_stream_context_create')) {
         runkit_function_remove('stream_context_create');
         runkit_function_rename('TEST_SAVED_stream_context_create', 'stream_context_create');
     }
     self::$fgcReturn = '{}';
 }
开发者ID:evoke-php,项目名称:eway,代码行数:12,代码来源:AccessCodeTest.php

示例10: blackMagicBeforeSuite

 /**
  * @BeforeSuite
  */
 public static function blackMagicBeforeSuite(SuiteEvent $event)
 {
     $parameters = $event->getContextParameters();
     if (false === isset($parameters['customDate'])) {
         throw new \Exception("You don't have customDate in your behat parameters\n");
     }
     global $custom_date;
     self::$_date = $custom_date = $parameters['customDate'];
     $rename = function ($real_name, $fake_name) {
         runkit_function_rename($real_name, "real_{$real_name}");
         runkit_function_rename("ETNA\\FeatureContext\\{$fake_name}", $real_name);
     };
     $rename("time", "fakeTime");
     $rename("date", "fakeDate");
     $rename("strtotime", "fakeStrtotime");
 }
开发者ID:TinyTinyKame,项目名称:composer-behat-utils,代码行数:19,代码来源:FixedTime.php

示例11: override

 /**
  * @param string $f
  */
 protected function override($f)
 {
     runkit_function_rename($f, $f . '_native');
     runkit_function_rename('PHPDaemon\\Thread\\' . $f, $f);
 }
开发者ID:cobolbaby,项目名称:phpdaemon,代码行数:8,代码来源:Worker.php

示例12: runkit_function_add

        runkit_function_add("time", "", <<<FUNC
\t        return original_time() + \$_ENV["{$travelName}"];
FUNC
);
        // replace strtotime()
        runkit_function_rename("strtotime", "original_strtotime");
        runkit_function_add("strtotime", '$time, $now = 0', <<<'FUNC'
	        if (isset($now)
	                && !empty($now))
	            return original_strtotime($time, $now);
	        else
	            return original_strtotime($time, time());
FUNC
);
        // replace date()
        runkit_function_rename("date", "original_date");
        runkit_function_add("date", '$format, $timestamp = 0', <<<'FUNC'
	        if (isset($timestamp)
	                && !empty($timestamp))
	            return original_date($format, $timestamp);
	        else
	            return original_date($format, time());
FUNC
);
        return true;
    };
    if (extension_loaded("uopz")) {
        ini_set("uopz.overloads", 1);
        return $travelByUopz;
    } else {
        if (extension_loaded("runkit")) {
开发者ID:goghcrow,项目名称:timeTravel,代码行数:31,代码来源:timeTravel.php

示例13: revertRedefinedFunction

 /**
  * Revert redefenition of the function
  *
  * @param string $function
  */
 public function revertRedefinedFunction($function)
 {
     $this->checkFunctionExists($function);
     $backupFunction = $this->getBackupName($function);
     try {
         $this->checkFunctionExists($backupFunction);
     } catch (PStub_RunkitAdapter_Exception $e) {
         throw new PStub_RunkitAdapter_Exception('Function ' . $function . ' was never redefined');
     }
     runkit_function_remove($function);
     runkit_function_rename($backupFunction, $function);
 }
开发者ID:realweb-team,项目名称:pstub,代码行数:17,代码来源:RunkitAdapter.php

示例14: restore

 /**
  *    Removes the mock function implementation and restores
  *    the previously declared implementation
  *    @access public
  */
 function restore()
 {
     runkit_function_remove($this->_function) or trigger_error('Error removing mock function', E_USER_ERROR);
     runkit_function_rename($this->_tmp_function, $this->_function) or trigger_error('Error restoring real function', E_USER_ERROR);
 }
开发者ID:pyfun,项目名称:dokuwiki,代码行数:10,代码来源:mock_functions.php

示例15: override

 /**
  * Override a standard PHP function
  * @param string $local e.g. isUploadedFile
  * @param string $real e.g. is_uploaded_file
  */
 protected function override($camelCase, $real)
 {
     runkit_function_rename($real, $real . '_native');
     runkit_function_rename('PHPDaemon\\Thread\\' . $camelCase, $real);
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:10,代码来源:Worker.php


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