本文整理汇总了PHP中PHPUnit_Runner_Version::series方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Runner_Version::series方法的具体用法?PHP PHPUnit_Runner_Version::series怎么用?PHP PHPUnit_Runner_Version::series使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Runner_Version
的用法示例。
在下文中一共展示了PHPUnit_Runner_Version::series方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doGenerateMock
private static function doGenerateMock($args, $isAbstract = false)
{
$testCase = self::extractTestCaseFromArgs($args);
$methodName = $isAbstract ? 'getMockForAbstractClass' : 'getMock';
$generatorClass = new \PHPUnit_Framework_MockObject_Generator();
// using PHPUnit 5.4 mocks registration
if (version_compare(\PHPUnit_Runner_Version::series(), '5.4', '>=') && $testCase instanceof \PHPUnit_Framework_TestCase) {
$mock = call_user_func_array([$generatorClass, $methodName], $args);
$testCase->registerMockObject($mock);
return $mock;
}
if ($testCase instanceof \PHPUnit_Framework_TestCase) {
$generatorClass = $testCase;
}
return call_user_func_array([$generatorClass, $methodName], $args);
}
示例2: 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);
}
示例3: handleArguments
//.........这里部分代码省略.........
case '--debug':
$this->arguments['debug'] = true;
break;
case 'h':
case '--help':
$this->showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--filter':
$this->arguments['filter'] = $option[1];
break;
case '--testsuite':
$this->arguments['testsuite'] = $option[1];
break;
case '--generate-configuration':
$this->printVersionString();
printf("Generating phpunit.xml in %s\n\n", getcwd());
print 'Bootstrap script (relative to path shown above; default: vendor/autoload.php): ';
$bootstrapScript = trim(fgets(STDIN));
print 'Tests directory (relative to path shown above; default: tests): ';
$testsDirectory = trim(fgets(STDIN));
print 'Source directory (relative to path shown above; default: src): ';
$src = trim(fgets(STDIN));
if ($bootstrapScript == '') {
$bootstrapScript = 'vendor/autoload.php';
}
if ($testsDirectory == '') {
$testsDirectory = 'tests';
}
if ($src == '') {
$src = 'src';
}
$generator = new PHPUnit_Util_ConfigurationGenerator();
file_put_contents('phpunit.xml', $generator->generateDefaultConfiguration(PHPUnit_Runner_Version::series(), $bootstrapScript, $testsDirectory, $src));
printf("\nGenerated phpunit.xml in %s\n", getcwd());
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--group':
$this->arguments['groups'] = explode(',', $option[1]);
break;
case '--exclude-group':
$this->arguments['excludeGroups'] = explode(',', $option[1]);
break;
case '--test-suffix':
$this->arguments['testSuffixes'] = explode(',', $option[1]);
break;
case '--include-path':
$includePath = $option[1];
break;
case '--list-groups':
$this->arguments['listGroups'] = true;
break;
case '--list-suites':
$this->arguments['listSuites'] = true;
break;
case '--printer':
$this->arguments['printer'] = $option[1];
break;
case '--loader':
$this->arguments['loader'] = $option[1];
break;
case '--log-junit':
$this->arguments['junitLogfile'] = $option[1];
break;
case '--log-teamcity':
$this->arguments['teamcityLogfile'] = $option[1];