本文整理汇总了PHP中PHPUnit_Framework_Test::run方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Test::run方法的具体用法?PHP PHPUnit_Framework_Test::run怎么用?PHP PHPUnit_Framework_Test::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Test
的用法示例。
在下文中一共展示了PHPUnit_Framework_Test::run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doEnhancedRun
public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = array())
{
unset($GLOBALS['app']);
// hook for not to serialize globals
$arguments = array_merge($this->defaultArguments, $arguments);
$this->handleConfiguration($arguments);
$result->convertErrorsToExceptions(false);
if ($arguments['report']) {
$this->printer = new Report();
}
if (empty(self::$persistentListeners)) {
$this->applyReporters($result, $arguments);
}
$arguments['listeners'][] = $this->printer;
// clean up listeners between suites
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
foreach ($arguments['listeners'] as $listener) {
$result->removeListener($listener);
}
return $result;
}
示例2: doEnhancedRun
public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = [])
{
unset($GLOBALS['app']);
// hook for not to serialize globals
$this->handleConfiguration($arguments);
$result->convertErrorsToExceptions(false);
if (empty(self::$persistentListeners)) {
$this->applyReporters($result, $arguments);
}
$arguments['listeners'][] = $this->printer;
// clean up listeners between suites
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$filterFactory = new \PHPUnit_Runner_Filter_Factory();
if ($arguments['groups']) {
$filterFactory->addFilter(new \ReflectionClass('PHPUnit_Runner_Filter_Group_Include'), $arguments['groups']);
}
if ($arguments['excludeGroups']) {
$filterFactory->addFilter(new \ReflectionClass('PHPUnit_Runner_Filter_Group_Exclude'), $arguments['excludeGroups']);
}
if ($arguments['filter']) {
$filterFactory->addFilter(new \ReflectionClass('PHPUnit_Runner_Filter_Test'), $arguments['filter']);
}
$suite->injectFilter($filterFactory);
$suite->run($result);
unset($suite);
foreach ($arguments['listeners'] as $listener) {
$result->removeListener($listener);
}
return $result;
}
示例3: doEnhancedRun
public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = [])
{
unset($GLOBALS['app']);
// hook for not to serialize globals
$result->convertErrorsToExceptions(false);
if (empty(self::$persistentListeners)) {
$this->applyReporters($result, $arguments);
}
if (class_exists('\\Symfony\\Bridge\\PhpUnit\\SymfonyTestsListener')) {
$arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
$arguments['listeners'][] = new \Symfony\Bridge\PhpUnit\SymfonyTestsListener();
}
$arguments['listeners'][] = $this->printer;
// clean up listeners between suites
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$suite->run($result);
unset($suite);
foreach ($arguments['listeners'] as $listener) {
$result->removeListener($listener);
}
return $result;
}
示例4: runTest
/**
* Runs a test.
*
* @deprecated
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_TestResult $result
*/
public function runTest(PHPUnit_Framework_Test $test, PHPUnit_Framework_TestResult $result)
{
$test->run($result);
}
示例5: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($arguments);
if (isset($arguments['bootstrap'])) {
$bootstrap = PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
if ($bootstrap) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $bootstrap;
}
}
if ($arguments['backupGlobals'] === FALSE) {
$suite->setBackupGlobals(FALSE);
}
if ($arguments['backupStaticAttributes'] === FALSE) {
$suite->setBackupStaticAttributes(FALSE);
}
$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['stopOnFailure']) {
$result->stopOnFailure(TRUE);
}
if ($this->printer === NULL) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$this->printer = new PHPUnit_TextUI_ResultPrinter(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP && !self::$versionStringPrinted) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if (isset($arguments['storyHTMLFile'])) {
require_once 'PHPUnit/Extensions/Story/ResultPrinter/HTML.php';
$result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_HTML($arguments['storyHTMLFile']));
}
if (isset($arguments['storyTextFile'])) {
require_once 'PHPUnit/Extensions/Story/ResultPrinter/Text.php';
$result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_Text($arguments['storyTextFile']));
}
if (isset($arguments['testdoxHTMLFile'])) {
require_once 'PHPUnit/Util/TestDox/ResultPrinter/HTML.php';
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
require_once 'PHPUnit/Util/TestDox/ResultPrinter/Text.php';
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory'])) && extension_loaded('xdebug')) {
$result->collectCodeCoverageInformation(TRUE);
}
if (isset($arguments['logDbus'])) {
require_once 'PHPUnit/Util/Log/DBUS.php';
$result->addListener(new PHPUnit_Util_Log_DBUS());
}
if (isset($arguments['jsonLogfile'])) {
require_once 'PHPUnit/Util/Log/JSON.php';
$result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
}
if (isset($arguments['tapLogfile'])) {
require_once 'PHPUnit/Util/Log/TAP.php';
$result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
}
if (isset($arguments['junitLogfile'])) {
require_once 'PHPUnit/Util/Log/JUnit.php';
$result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
$result->flushListeners();
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$this->printer->printResult($result);
}
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
if (isset($arguments['coverageClover'])) {
$this->printer->write("\nWriting code coverage data to XML file, this may take " . 'a moment.');
require_once 'PHP/CodeCoverage/Report/Clover.php';
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($result->getCodeCoverage(), $arguments['coverageClover']);
$this->printer->write("\n");
unset($writer);
}
if (isset($arguments['reportDirectory'])) {
$this->printer->write("\nGenerating code coverage report, this may take a moment.");
$title = '';
//.........这里部分代码省略.........
示例6: doRun
/**
* Runs a test suite.
*
* @param PHPUnit_Framework_Test $suite
* @param optional boolean $wait
* @return PHPUnit_Framework_TestResult
* @access public
*/
public function doRun(PHPUnit_Framework_Test $suite, $wait = false)
{
printf("PHPUnit %s by Sebastian Bergmann.\n\n", PHPUnit_Framework_Version);
$result = new PHPUnit_Framework_TestResult();
$result->addListener($this->fPrinter);
$timer = new Benchmark_Timer();
$timer->start();
$suite->run($result);
$timer->stop();
$this->pause($wait);
$this->fPrinter->printResult($result, $timer->timeElapsed());
return $result;
}