本文整理汇总了PHP中PHPUnit_Runner_Version::getVersionString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Runner_Version::getVersionString方法的具体用法?PHP PHPUnit_Runner_Version::getVersionString怎么用?PHP PHPUnit_Runner_Version::getVersionString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Runner_Version
的用法示例。
在下文中一共展示了PHPUnit_Runner_Version::getVersionString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$options = $input->getOptions();
if ($input->getArgument('test')) {
$options['steps'] = true;
}
$suite = $input->getArgument('suite');
$test = $input->getArgument('test');
$codecept = new \Codeception\Codecept((array) $options);
$suites = $suite ? array($suite) : \Codeception\Configuration::suites();
$output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
if ($suite and $test) {
$codecept->runSuite($suite, $test);
}
if (!$test) {
foreach ($suites as $suite) {
$codecept->runSuite($suite);
}
}
$codecept->printResult();
if (!$input->getOption('no-exit')) {
if ($codecept->getResult()->failureCount() or $codecept->getResult()->errorCount()) {
exit(1);
}
}
}
示例2: testAdapterRunsPhpunitCommandWithAlltestsFileTarget
public function testAdapterRunsPhpunitCommandWithAlltestsFileTarget()
{
$adapter = new \Mutateme\Adapter\Phpunit();
$options = array('src' => dirname(__FILE__) . '/_files/phpunit2', 'tests' => dirname(__FILE__) . '/_files/phpunit2', 'base' => dirname(__FILE__) . '/_files/phpunit2', 'options' => 'AllMyTests.php');
ob_start();
$adapter->execute($options, true);
$this->assertStringStartsWith(\PHPUnit_Runner_Version::getVersionString(), ob_get_clean());
}
示例3: testAdapterRunsPhpunitCommandWithAlltestsFileTarget
public function testAdapterRunsPhpunitCommandWithAlltestsFileTarget()
{
$runner = m::mock('\\Mutagenesis\\Runner\\Base');
$runner->shouldReceive('getOptions')->andReturn(array('src' => dirname(__FILE__) . '/_files/phpunit2', 'tests' => dirname(__FILE__) . '/_files/phpunit2', 'base' => dirname(__FILE__) . '/_files/phpunit2', 'cache' => sys_get_temp_dir(), 'clioptions' => array(), 'constraint' => 'AllTests.php'));
$runner->shouldReceive(array('getBootstrap' => null, 'getTimeout' => 1200));
$adapter = new \Mutagenesis\Adapter\Phpunit();
$result = $adapter->runTests($runner, true, true);
$this->assertStringStartsWith(\PHPUnit_Runner_Version::getVersionString(), $result[1]['stdout']);
}
示例4: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
$options = $input->getOptions();
if ($options['debug']) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
}
$options['verbosity'] = $output->getVerbosity();
if (!extension_loaded('curl')) {
throw new \Exception("Codeception requires CURL extension installed to make tests run\n" . "If you are not sure, how to install CURL, pls refer to StackOverflow\n\n" . "Notice: PHP for Apache/Nginx and CLI can have different php.ini files.\n" . "Please make sure that your PHP you run from console has CURL enabled.");
}
$config = Configuration::config($options['config']);
$suite = $input->getArgument('suite');
$test = $input->getArgument('test');
if (!Configuration::isEmpty() && !$test && strpos($suite, $config['paths']['tests']) === 0) {
list($matches, $suite, $test) = $this->matchTestFromFilename($suite, $config['paths']['tests']);
}
if ($options['group']) {
$output->writeln(sprintf("[Groups] <info>%s</info> ", implode(', ', $options['group'])));
}
if ($input->getArgument('test')) {
$options['steps'] = true;
}
if ($test) {
$filter = $this->matchFilteredTestName($test);
$options['filter'] = $filter;
}
$this->codecept = new \Codeception\Codecept((array) $options);
if ($suite and $test) {
$this->codecept->run($suite, $test);
}
if (!$test) {
$suites = $suite ? explode(',', $suite) : Configuration::suites();
$current_dir = Configuration::projectDir();
$executed = $this->runSuites($suites, $options['skip']);
foreach ($config['include'] as $included_config_file) {
Configuration::config($full_path = $current_dir . $included_config_file);
$namespace = $this->currentNamespace();
$output->writeln("\n<fg=white;bg=magenta>\n[{$namespace}]: tests from {$full_path}\n</fg=white;bg=magenta>");
$suites = $suite ? explode(',', $suite) : Configuration::suites();
$executed += $this->runSuites($suites, $options['skip']);
}
if (!$executed) {
throw new \RuntimeException(sprintf("Suite '%s' could not be found", implode(', ', $suites)));
}
}
$this->codecept->printResult();
if (!$input->getOption('no-exit')) {
if ($this->codecept->getResult()->failureCount() or $this->codecept->getResult()->errorCount()) {
exit(1);
}
}
}
示例5: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
$options = $input->getOptions();
if ($options['debug']) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
}
$config = Configuration::config($options['config']);
$suite = $input->getArgument('suite');
$test = $input->getArgument('test');
if (!Configuration::isEmpty() && !$test && strpos($suite, $config['paths']['tests']) === 0) {
list($matches, $suite, $test) = $this->matchTestFromFilename($suite, $config['paths']['tests']);
}
if ($options['group']) {
$output->writeln(sprintf("[Groups] <info>%s</info> ", implode(', ', $options['group'])));
}
if ($input->getArgument('test')) {
$options['steps'] = true;
}
$this->codecept = new \Codeception\Codecept((array) $options);
if ($suite and $test) {
$this->codecept->runSuite($suite, $test);
}
if (!$test) {
$suites = $suite ? explode(',', $suite) : Configuration::suites();
$current_dir = Configuration::projectDir();
$executed = $this->runSuites($suites, $options['skip']);
foreach ($config['include'] as $included_config_file) {
Configuration::config($full_path = $current_dir . $included_config_file);
$namespace = $this->currentNamespace();
$output->writeln("\n<fg=white;bg=magenta>\n[{$namespace}]: tests from {$full_path}\n</fg=white;bg=magenta>");
$suites = $suite ? explode(',', $suite) : Configuration::suites();
$executed += $this->runSuites($suites, $options['skip']);
}
if (!$executed) {
throw new \RuntimeException(sprintf("Suite '%s' could not be found", implode(', ', $suites)));
}
}
$this->codecept->printResult();
if (!$input->getOption('no-exit')) {
if ($this->codecept->getResult()->failureCount() or $this->codecept->getResult()->errorCount()) {
exit(1);
}
}
}
示例6: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
$options = $input->getOptions();
if ($options['group']) {
$output->writeln(sprintf("[Groups] <info>%s</info> ", implode(', ', $options['group'])));
}
if ($input->getArgument('test') && strtolower(substr($input->getArgument('test'), -4)) === '.php') {
$options['steps'] = true;
}
if ($input->getOption('debug')) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
}
$suite = $input->getArgument('suite');
$test = $input->getArgument('test');
$codecept = new \Codeception\Codecept((array) $options);
$config = \Codeception\Configuration::config();
if (strpos($suite, $config['paths']['tests']) === 0) {
$matches = $this->matchTestFromFilename($suite, $config['paths']['tests']);
$suite = $matches[1];
$test = $matches[2];
}
$suites = $suite ? array($suite) : \Codeception\Configuration::suites();
if ($suite and $test) {
$codecept->runSuite($suite, $test);
}
if (!$test) {
foreach ($suites as $suite) {
$codecept->runSuite($suite);
}
}
$codecept->printResult();
if (!$input->getOption('no-exit')) {
if ($codecept->getResult()->failureCount() or $codecept->getResult()->errorCount()) {
exit(1);
}
}
}
示例7: execute
/**
* Executes Run
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @throws \RuntimeException
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$this->ensureCurlIsAvailable();
$this->options = $input->getOptions();
$this->output = $output;
$config = Configuration::config($this->options['config']);
if (!$this->options['colors']) {
$this->options['colors'] = $config['settings']['colors'];
}
if (!$this->options['silent']) {
$this->output->writeln(Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
}
if ($this->options['debug']) {
$this->output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
}
$userOptions = array_intersect_key($this->options, array_flip($this->passedOptionKeys($input)));
$userOptions = array_merge($userOptions, $this->booleanOptions($input, ['xml', 'html', 'json', 'tap', 'coverage', 'coverage-xml', 'coverage-html']));
$userOptions['verbosity'] = $this->output->getVerbosity();
if ($this->options['no-colors']) {
$userOptions['colors'] = false;
}
if ($this->options['group']) {
$userOptions['groups'] = $this->options['group'];
}
if ($this->options['skip-group']) {
$userOptions['excludeGroups'] = $this->options['skip-group'];
}
if ($this->options['report']) {
$userOptions['silent'] = true;
}
if ($this->options['coverage-xml'] or $this->options['coverage-html'] or $this->options['coverage-text']) {
$this->options['coverage'] = true;
}
$suite = $input->getArgument('suite');
$test = $input->getArgument('test');
if (!Configuration::isEmpty() && !$test && strpos($suite, $config['paths']['tests']) === 0) {
list($matches, $suite, $test) = $this->matchTestFromFilename($suite, $config['paths']['tests']);
}
if ($this->options['group']) {
$this->output->writeln(sprintf("[Groups] <info>%s</info> ", implode(', ', $this->options['group'])));
}
if ($input->getArgument('test')) {
$this->options['steps'] = true;
}
if ($test) {
$filter = $this->matchFilteredTestName($test);
$userOptions['filter'] = $filter;
}
$this->codecept = new Codecept($userOptions);
if ($suite and $test) {
$this->codecept->run($suite, $test);
}
if (!$test) {
$suites = $suite ? explode(',', $suite) : Configuration::suites();
$this->executed = $this->runSuites($suites, $this->options['skip']);
if (!empty($config['include'])) {
$current_dir = Configuration::projectDir();
$suites += $config['include'];
$this->runIncludedSuites($config['include'], $current_dir);
}
if ($this->executed === 0) {
throw new \RuntimeException(sprintf("Suite '%s' could not be found", implode(', ', $suites)));
}
}
$this->codecept->printResult();
if (!$input->getOption('no-exit')) {
if (!$this->codecept->getResult()->wasSuccessful()) {
exit(1);
}
}
}
示例8: main
/**
* Main function of the module. Outputs all content directly instead of collecting it and doing the output later.
*
* @return void
*/
public function main()
{
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
if ($GLOBALS['BE_USER']->user['admin']) {
$this->doc->docType = 'xhtml_strict';
$this->doc->bodyTagAdditions = 'id="doc3"';
$this->addAdditionalHeaderData();
$this->cleanOutputBuffers();
$this->outputService->output($this->doc->startPage($this->translate('title')) . $this->doc->header(PHPUnit_Runner_Version::getVersionString()));
$this->renderRunTests();
$this->outputService->output($this->doc->section($this->translate('shortcuts.title'), '<p>' . $this->translate('shortcuts.text') . '</p>
<p>' . $this->translate('shortcuts.browser_dependency') . '</p>
<ul>
<li>' . $this->translate('shortcuts.browser_safari_ie') . '</li>
<li>' . $this->translate('shortcuts.browser_firefox') . '</li>
</ul>' . $this->doc->section('', $this->createOpenNewWindowLink())));
} else {
$this->outputService->output($this->doc->startPage($this->translate('title')) . $this->doc->header($this->translate('title')) . $this->translate('admin_rights_needed'));
}
$this->outputService->output($this->doc->endPage());
}
示例9: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @param bool $exit
*
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = [], $exit)
{
if (isset($arguments['configuration'])) {
$GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration'];
}
$this->handleConfiguration($arguments);
$this->processSuiteFilters($suite, $arguments);
if (isset($arguments['bootstrap'])) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}
if ($arguments['backupGlobals'] === false) {
$suite->setBackupGlobals(false);
}
if ($arguments['backupStaticAttributes'] === true) {
$suite->setBackupStaticAttributes(true);
}
if ($arguments['beStrictAboutChangesToGlobalState'] === true) {
$suite->setbeStrictAboutChangesToGlobalState(true);
}
if (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['processIsolation']);
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest($test);
}
$result = $this->createTestResult();
if (!$arguments['convertErrorsToExceptions']) {
$result->convertErrorsToExceptions(false);
}
if (!$arguments['convertNoticesToExceptions']) {
PHPUnit_Framework_Error_Notice::$enabled = false;
}
if (!$arguments['convertWarningsToExceptions']) {
PHPUnit_Framework_Error_Warning::$enabled = false;
}
if ($arguments['stopOnError']) {
$result->stopOnError(true);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(true);
}
if ($arguments['stopOnWarning']) {
$result->stopOnWarning(true);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(true);
}
if ($arguments['stopOnRisky']) {
$result->stopOnRisky(true);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(true);
}
if ($this->printer === null) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$printerClass = 'PHPUnit_TextUI_ResultPrinter';
if (isset($arguments['printer']) && is_string($arguments['printer']) && class_exists($arguments['printer'], false)) {
$class = new ReflectionClass($arguments['printer']);
if ($class->isSubclassOf('PHPUnit_TextUI_ResultPrinter')) {
$printerClass = $arguments['printer'];
}
}
$this->printer = new $printerClass(isset($arguments['stderr']) ? 'php://stderr' : null, $arguments['verbose'], $arguments['colors'], $arguments['debug'], $arguments['columns'], $arguments['reverseList']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n");
self::$versionStringPrinted = true;
if ($arguments['verbose']) {
$runtime = $this->runtime->getNameWithVersion();
if ($this->runtime->hasXdebug()) {
$runtime .= sprintf(' with Xdebug %s', phpversion('xdebug'));
}
$this->writeMessage('Runtime', $runtime);
if (isset($arguments['configuration'])) {
$this->writeMessage('Configuration', $arguments['configuration']->getFilename());
}
}
if (isset($arguments['deprecatedCheckForUnintentionallyCoveredCodeSettingUsed'])) {
print "Warning: Deprecated configuration setting \"checkForUnintentionallyCoveredCode\" used\n";
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if (isset($arguments['testdoxHTMLFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
//.........这里部分代码省略.........
示例10: isPhpunitVersionGreaterOrEquals
/**
* isPhpunitVersionGreaterOrEquals
*
* @param String $version for example '3.6.0'
*/
public function isPhpunitVersionGreaterOrEquals($version)
{
$phpUnitVersion = explode(' ', PHPUnit_Runner_Version::getVersionString());
return version_compare($phpUnitVersion[1], $version) >= 0;
}
示例11: main
/**
* Main function of the module. Outputs all content directly instead of collecting it and doing the output later.
*
* @return void
*/
public function main()
{
if ($GLOBALS['BE_USER']->user['admin']) {
$this->doc = t3lib_div::makeInstance('bigDoc');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->docType = 'xhtml_strict';
$this->doc->bodyTagAdditions = 'id="doc3"';
$this->addAdditionalHeaderData();
$this->cleanOutputBuffers();
$this->outputService->output($this->doc->startPage($this->translate('title')) . $this->doc->header(PHPUnit_Runner_Version::getVersionString()));
$this->renderRunTests();
$this->outputService->output($this->doc->section('Keyboard shortcuts', '<p>Use "a" for running all tests, use "s" for running a single test and
use "r" to re-run the latest tests; to open phpunit in a new window, use "n".</p>
<p>Depending on your browser and system you will need to press some
modifier keys:</p>
<ul>
<li>Safari, IE and Firefox 1.x: Use "Alt" button on Windows, "Ctrl" on Macs.</li>
<li>Firefox 2.x and 3.x: Use "Alt-Shift" on Windows, "Ctrl-Shift" on Macs</li>
</ul>' . $this->doc->section('', $this->createOpenNewWindowLink())));
} else {
$this->doc = t3lib_div::makeInstance('bigDoc');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->outputService->output($this->doc->startPage($this->translate('title')) . $this->doc->header($this->translate('title')) . $this->translate('admin_rights_needed'));
}
$this->outputService->output($this->doc->endPage());
}
示例12: define
* Set parameters for logging (call via browser)
*
* @todo put that in config.inc as well or remove that?
*/
define('CONFIGURATION', PATH_TO_TEST_DIR . "/conf.xml");
/*
* Set up basic tine 2.0 environment
*/
require_once 'bootstrap.php';
// add test paths to autoloader
$autoloader = (require 'vendor/autoload.php');
$autoloader->set('', $path);
/*
* Set white / black lists
*/
$phpUnitVersion = explode(' ', PHPUnit_Runner_Version::getVersionString());
if (version_compare($phpUnitVersion[1], "3.6.0") >= 0) {
$filter = new PHP_CodeCoverage_Filter();
$filter->addDirectoryToBlacklist(dirname(__FILE__));
} else {
if (version_compare($phpUnitVersion[1], "3.5.0") >= 0) {
PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(dirname(__FILE__));
} else {
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
}
}
// get config
$configData = (include 'phpunitconfig.inc.php');
$config = new Zend_Config($configData);
$_SERVER['DOCUMENT_ROOT'] = $config->docroot;
Setup_TestServer::getInstance()->initFramework();
示例13: showError
private function showError($message)
{
print \PHPUnit_Runner_Version::getVersionString() . "\n\n";
print $message . "\n";
exit(\PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
}
示例14: date
<?php
if (!class_exists('PHP_Timer', false)) {
require 'PHP/Timer.php';
}
?>
<div id="footer">
<div class="w3c-valid-html"><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"></a></div>
<div class="w3c-valid-css"><a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!"></a></div>
<div class="copyright">© <?php
echo date('Y');
?>
Nick Turner. Inspired by Matt Mueller.<br><?php
echo htmlentities(PHPUnit_Runner_Version::getVersionString());
?>
<br><?php
echo htmlentities(PHP_Timer::resourceUsage());
?>
</div>
</div>
</div>
<script src="<?php
echo $this->url('/template/javascript/jquery.js');
?>
" type="text/javascript" charset="utf-8"></script>
<script src="<?php
echo $this->url('/template/javascript/main.js');
?>
" type="text/javascript" charset="utf-8"></script>
</body>
示例15: write
/**
* @param string $buffer
*/
public function write($buffer)
{
// A bit of a hack to intercept the version string announcing PHPUnit before it's printed;
// done for --hide-summary. Unclean, but all else is worse.
$hide_summary = $this->options->get('hide-summary');
if ($hide_summary and $buffer === PHPUnit_Runner_Version::getVersionString() . "\n\n") {
return;
}
print $buffer;
if ($this->autoFlush) {
$this->incrementalFlush();
}
}