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


PHP PHPUnit_Runner_Version::getReleaseChannel方法代码示例

本文整理汇总了PHP中PHPUnit_Runner_Version::getReleaseChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Runner_Version::getReleaseChannel方法的具体用法?PHP PHPUnit_Runner_Version::getReleaseChannel怎么用?PHP PHPUnit_Runner_Version::getReleaseChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Runner_Version的用法示例。


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

示例1: handleSelfUpdate

 /**
  * @since Method available since Release 4.0.0
  */
 protected function handleSelfUpdate($upgrade = false)
 {
     $this->printVersionString();
     $localFilename = realpath($_SERVER['argv'][0]);
     if (!is_writable($localFilename)) {
         print 'No write permission to update ' . $localFilename . "\n";
         exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
     }
     if (!extension_loaded('openssl')) {
         print "The OpenSSL extension is not loaded.\n";
         exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
     }
     if (!$upgrade) {
         $remoteFilename = sprintf('https://phar.phpunit.de/phpunit-%s.phar', file_get_contents(sprintf('https://phar.phpunit.de/latest-version-of/phpunit-%s', PHPUnit_Runner_Version::series())));
     } else {
         $remoteFilename = sprintf('https://phar.phpunit.de/phpunit%s.phar', PHPUnit_Runner_Version::getReleaseChannel());
     }
     $tempFilename = tempnam(sys_get_temp_dir(), 'phpunit') . '.phar';
     // Workaround for https://bugs.php.net/bug.php?id=65538
     $caFile = dirname($tempFilename) . '/ca.pem';
     copy(__PHPUNIT_PHAR_ROOT__ . '/ca.pem', $caFile);
     print 'Updating the PHPUnit PHAR ... ';
     $options = ['ssl' => ['allow_self_signed' => false, 'cafile' => $caFile, 'verify_peer' => true]];
     file_put_contents($tempFilename, file_get_contents($remoteFilename, false, stream_context_create($options)));
     chmod($tempFilename, 0777 & ~umask());
     try {
         $phar = new Phar($tempFilename);
         unset($phar);
         rename($tempFilename, $localFilename);
         unlink($caFile);
     } catch (Throwable $_e) {
         $e = $_e;
     } catch (Exception $_e) {
         $e = $_e;
     }
     if (isset($e)) {
         unlink($caFile);
         unlink($tempFilename);
         print " done\n\n" . $e->getMessage() . "\n";
         exit(2);
     }
     print " done\n";
     exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
 }
开发者ID:tangyu,项目名称:phpunit,代码行数:47,代码来源:Command.php

示例2: handleSelfUpdate

 /**
  * @since Method available since Release 4.0.0
  */
 protected function handleSelfUpdate()
 {
     $this->printVersionString();
     if (!extension_loaded('openssl')) {
         print "The OpenSSL extension is not loaded.\n";
         exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
     }
     $remoteFilename = sprintf('https://phar.phpunit.de/phpunit%s.phar', PHPUnit_Runner_Version::getReleaseChannel());
     $localFilename = realpath($_SERVER['argv'][0]);
     $tempFilename = basename($localFilename, '.phar') . '-temp.phar';
     // Workaround for https://bugs.php.net/bug.php?id=65538
     $caFile = dirname($tempFilename) . '/ca.pem';
     copy(__PHPUNIT_PHAR_ROOT__ . '/ca.pem', $caFile);
     print 'Updating the PHPUnit PHAR ... ';
     $options = array('ssl' => array('allow_self_signed' => false, 'cafile' => $caFile, 'verify_peer' => true));
     if (PHP_VERSION_ID < 50600) {
         $options['ssl']['CN_match'] = 'phar.phpunit.de';
         $options['ssl']['SNI_server_name'] = 'phar.phpunit.de';
     }
     file_put_contents($tempFilename, file_get_contents($remoteFilename, false, stream_context_create($options)));
     chmod($tempFilename, 0777 & ~umask());
     try {
         $phar = new Phar($tempFilename);
         unset($phar);
         rename($tempFilename, $localFilename);
         unlink($caFile);
     } catch (Exception $e) {
         unlink($caFile);
         unlink($tempFilename);
         print " done\n\n" . $e->getMessage() . "\n";
         exit(2);
     }
     print " done\n";
     exit(0);
 }
开发者ID:HarveyCheng,项目名称:myblog,代码行数:38,代码来源:Command.php


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