本文整理汇总了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);
}
示例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);
}