本文整理汇总了PHP中PHPUnit_TextUI_TestRunner::showError方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_TextUI_TestRunner::showError方法的具体用法?PHP PHPUnit_TextUI_TestRunner::showError怎么用?PHP PHPUnit_TextUI_TestRunner::showError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_TextUI_TestRunner
的用法示例。
在下文中一共展示了PHPUnit_TextUI_TestRunner::showError方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleBootstrap
/**
* Loads a bootstrap file.
*
* @param string $filename
* @param boolean $syntaxCheck
* @see PHPUnit_TextUI_Command::handleBootstrap()
* @since Method available since Release 2.16.0
*/
protected function handleBootstrap($filename, $syntaxCheck = false)
{
try {
PHPUnit_Util_Fileloader::checkAndLoad($filename, $syntaxCheck);
} catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
}
示例2: handleLoader
/**
* Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.
*
* @param string $loaderClass
* @param string $loaderFile
*/
protected function handleLoader($loaderClass, $loaderFile = '')
{
if (!class_exists($loaderClass, FALSE)) {
if ($loaderFile == '') {
$loaderFile = PHPUnit_Util_Filesystem::classNameToFilename($loaderClass);
}
$loaderFile = PHPUnit_Util_Filesystem::fileExistsInIncludePath($loaderFile);
if ($loaderFile !== FALSE) {
require $loaderFile;
}
}
if (class_exists($loaderClass, FALSE)) {
$class = new ReflectionClass($loaderClass);
if ($class->implementsInterface('PHPUnit_Runner_TestSuiteLoader') && $class->isInstantiable()) {
$loader = $class->newInstance();
}
}
if (!isset($loader)) {
PHPUnit_TextUI_TestRunner::showError(sprintf('Could not use "%s" as loader.', $loaderClass));
}
return $loader;
}
示例3: handleBootstrap
/**
* Loads a bootstrap file.
*
* @param string $filename
*/
protected function handleBootstrap($filename)
{
try {
PHPUnit_Util_Fileloader::checkAndLoad($filename);
} catch (PHPUnit_Framework_Exception $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
}
示例4: handleArguments
/**
* This function is cut&paste from PHPUnit_TextUI_Command::handleArguments
* Removed the need for a required unnamed command option ( 'test')
**/
protected function handleArguments(array $argv)
{
try {
$this->options = PHPUnit_Util_Getopt::getopt(
$argv,
'd:c:',
array_keys($this->longOptions)
);
}
catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
$skeletonClass = FALSE;
$skeletonTest = FALSE;
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--colors': {
$this->arguments['colors'] = TRUE;
}
break;
case '--bootstrap': {
$this->arguments['bootstrap'] = $option[1];
}
break;
case 'c':
case '--configuration': {
$this->arguments['configuration'] = $option[1];
}
break;
case '--coverage-clover': {
if (extension_loaded('tokenizer') &&
extension_loaded('xdebug')) {
$this->arguments['coverageClover'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
$this->showMessage(
'The tokenizer extension is not loaded.'
);
} else {
$this->showMessage(
'The Xdebug extension is not loaded.'
);
}
}
}
break;
case '--coverage-html': {
if (extension_loaded('tokenizer') &&
extension_loaded('xdebug')) {
$this->arguments['reportDirectory'] = $option[1];
} else {
if (!extension_loaded('tokenizer')) {
$this->showMessage(
'The tokenizer extension is not loaded.'
);
} else {
$this->showMessage(
'The Xdebug extension is not loaded.'
);
}
}
}
break;
case 'd': {
$ini = explode('=', $option[1]);
if (isset($ini[0])) {
if (isset($ini[1])) {
ini_set($ini[0], $ini[1]);
} else {
ini_set($ini[0], TRUE);
}
}
}
break;
case '--debug': {
$this->arguments['debug'] = TRUE;
}
break;
case '--help': {
$this->showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
}
break;
case '--filter': {
//.........这里部分代码省略.........
示例5: handleLoader
/**
* @param string $loaderName
*/
protected static function handleLoader($loaderName)
{
if (!class_exists($loaderName, FALSE)) {
PHPUnit_Util_Fileloader::checkAndLoad(str_replace('_', '/', $loaderName) . '.php');
}
if (class_exists($loaderName, FALSE)) {
$class = new ReflectionClass($loaderName);
if ($class->implementsInterface('PHPUnit_Runner_TestSuiteLoader') && $class->isInstantiable()) {
$loader = $class->newInstance();
}
}
if (!isset($loader)) {
PHPUnit_TextUI_TestRunner::showError(sprintf('Could not use "%s" as loader.', $loaderName));
}
PHPUnit_TextUI_TestRunner::setLoader($loader);
}
示例6: createCodeCoverageFilter
/**
* Whitelists all kernel, lib and extension classes for code coverage
*
* @return PHP_CodeCoverage_Filter
*/
protected function createCodeCoverageFilter()
{
$filter = new PHP_CodeCoverage_Filter();
// Add kernel classes to whitelist
$kernelClassFiles = (require 'autoload/ezp_kernel.php');
$filter->addFilesToWhitelist($kernelClassFiles);
// Add extension classes to whitelist
if (!is_file('var/autoload/ezp_extension.php')) {
PHPUnit_TextUI_TestRunner::showError("Please generate the extension autoloads first.\n" . "You can generate them using php bin/php/ezpgenerateautoloads.php -e");
}
$extensionClassFiles = (require 'var/autoload/ezp_extension.php');
$filter->addFilesToWhitelist($extensionClassFiles);
return $filter;
}
示例7: processCommandlineOptions
/**
* Handles the commandline arguments passed.
*
* @return array the commandline arguments
*
* @author Felix Gilcher <felix.gilcher@bitextender.com>
* @since 1.0.0
*/
public static function processCommandlineOptions()
{
$longOptions = array('coverage-html=', 'coverage-clover=', 'coverage-source=', 'coverage-xml=', 'report=', 'environment=', 'help', 'log-graphviz=', 'log-json=', 'log-metrics=', 'log-pmd=', 'log-tap=', 'log-xml=', 'include-suite=', 'exclude-suite=');
try {
$options = PHPUnit_Util_Getopt::getopt($_SERVER['argv'], 'd:', $longOptions);
} catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
$arguments = array();
foreach ($options[0] as $option) {
switch ($option[0]) {
case '--coverage-clover':
case '--coverage-xml':
if (self::checkCodeCoverageDeps()) {
$arguments['coverageClover'] = $option[1];
}
break;
case '--coverage-source':
if (self::checkCodeCoverageDeps()) {
$arguments['coverageSource'] = $option[1];
}
break;
case '--coverage-html':
case '--report':
if (self::checkCodeCoverageDeps()) {
$arguments['reportDirectory'] = $option[1];
}
break;
case '--environment':
$arguments['environment'] = $option[1];
break;
case '--help':
self::showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--log-json':
$arguments['jsonLogfile'] = $option[1];
break;
case '--log-graphviz':
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
$arguments['graphvizLogfile'] = $option[1];
} else {
throw new AgaviException('The Image_GraphViz package is not installed.');
}
break;
case '--log-tap':
$arguments['tapLogfile'] = $option[1];
break;
case '--log-xml':
$arguments['xmlLogfile'] = $option[1];
break;
case '--log-pmd':
if (self::checkCodeCoverageDeps()) {
$arguments['pmdXML'] = $option[1];
}
break;
case '--log-metrics':
if (self::checkCodeCoverageDeps()) {
$arguments['metricsXML'] = $option[1];
}
break;
case '--include-suite':
$arguments['include-suite'] = $option[1];
break;
case '--exclude-suite':
$arguments['exclude-suite'] = $option[1];
break;
}
}
return $arguments;
}
示例8: readOptions
/**
* Read PHPUnit options
*/
protected function readOptions()
{
try {
$reader = new Core_FileReader();
$options = \PHPUnit_Util_Getopt::getopt($_SERVER['argv'], 'd:c:hv', array_keys($reader->getLongOptions()));
} catch (\PHPUnit_Framework_Exception $e) {
\PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
foreach ($options[0] as $option) {
$this->options[$option[0]] = isset($option[1]) ? $option[1] : true;
}
}
示例9: _initArguments
/**
* @access protected
* @static
*/
protected static function _initArguments()
{
$arguments['suite_filter'] = array();
$arguments['runner_parameters'] = array();
$longOptions = array('list-suites', 'new-suite=', 'suite-filter=', 'test-filter=', 'help', 'verbose', 'version');
try {
$options = PHPUnit_Util_Getopt::getopt($_SERVER['argv'], 'd:', $longOptions);
} catch (RuntimeException $e) {
PHPUnit_TextUI_TestRunner::showError($e->getMessage());
}
foreach ($options[0] as $option) {
switch ($option[0]) {
case 'd':
$ini = explode('=', $option[1]);
if (isset($ini[0])) {
if (isset($ini[1])) {
ini_set($ini[0], $ini[1]);
} else {
ini_set($ini[0], TRUE);
}
}
break;
case '--list-suites':
self::_listSuites();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--new-suite':
self::_createNewSuite($option[1]);
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--suite-filter':
$arguments['suite_filter'] = explode(",", $option[1]);
break;
case '--test-filter':
$arguments['runner_parameters']['filter'] = "/" . $option[1] . "/i";
break;
case '--help':
self::_showHelp();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
case '--verbose':
$arguments['runner_parameters']['verbose'] = true;
break;
case '--version':
self::_printVersionString();
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
break;
}
}
self::$_arguments = $arguments;
return true;
}