Source for file TestRunner.php
Documentation is available at TestRunner.php 
// +------------------------------------------------------------------------+  
// +------------------------------------------------------------------------+  
// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. |  
// +------------------------------------------------------------------------+  
// | This source file is subject to version 3.00 of the PHP License,        |  
// | that is available at http://www.php.net/license/3_0.txt.               |  
// | If you did not receive a copy of the PHP license and are unable to     |  
// | obtain it through the world-wide-web, please send a note to            |  
// | license@php.net so we can mail you a copy immediately.                 |  
// +------------------------------------------------------------------------+  
// $Id: TestRunner.php,v 1.46.2.5 2005/06/03 05:48:09 sebastian Exp $  
if (!defined('PHPUnit2_MAIN_METHOD')) {  
    define('PHPUnit2_MAIN_METHOD', 'PHPUnit2_TextUI_TestRunner::main');   
require_once 'Console/Getopt.php';   
require_once 'Benchmark/Timer.php';   
require_once 'PHPUnit2/Extensions/CodeCoverage/Renderer.php';   
require_once 'PHPUnit2/Extensions/Log/XML.php';   
require_once 'PHPUnit2/Extensions/TestDox/ResultPrinter.php';   
require_once 'PHPUnit2/Framework/AssertionFailedError.php';   
require_once 'PHPUnit2/Framework/Test.php';   
require_once 'PHPUnit2/Framework/TestSuite.php';   
require_once 'PHPUnit2/Framework/TestResult.php';   
require_once 'PHPUnit2/Runner/BaseTestRunner.php';   
require_once 'PHPUnit2/Runner/StandardTestSuiteLoader.php';   
require_once 'PHPUnit2/Runner/TestSuiteLoader.php';   
require_once 'PHPUnit2/Runner/Version.php';   
require_once 'PHPUnit2/TextUI/ResultPrinter.php';   
require_once 'PHPUnit2/Util/Skeleton.php';   
 * A TestRunner for the Command Line Interface (CLI)  
 * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>  
 * @copyright   Copyright © 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>  
 * @license     http://www.php.net/license/3_0.txt The PHP License, Version 3.0  
    // {{{ Instance Variables  
    * @var    PHPUnit2_Runner_TestSuiteLoader   
    * @var    PHPUnit2_TextUI_ResultPrinter   
    private  static $versionStringPrinted = FALSE;  
    // {{{ public static function main()  
    public  static function main() { 
            $result =  $aTestRunner->start ($_SERVER['argv']);   
            if (!$result->wasSuccessful ()) {  
                exit (self ::FAILURE_EXIT );  
            exit (self ::SUCCESS_EXIT );  
            self ::printVersionString ();  
            exit (self ::EXCEPTION_EXIT );  
    // {{{ protected function start($arguments)  
    * @param  array $arguments   
    protected  function start($arguments) { 
        $coverageDataFile = FALSE;   
        $coverageHTMLFile = FALSE;   
        $coverageTextFile = FALSE;   
        $testdoxHTMLFile  = FALSE;   
        $testdoxTextFile  = FALSE;   
        $possibleOptions = array (  
            $possibleOptions[] =  'log-xml=';   
            $possibleOptions[] =  'coverage-data=';   
            $possibleOptions[] =  'coverage-html=';   
            $possibleOptions[] =  'coverage-text=';   
        $options = Console_Getopt ::getopt (  
        if (PEAR ::isError ($options)) {  
        $test     = isset ($options[1 ][0 ]) ?  $options[1 ][0 ] : FALSE;   
        $testFile = isset ($options[1 ][1 ]) ?  $options[1 ][1 ] :  $test .  '.php';   
        foreach ($options[0 ] as  $option) {  
                case  '--coverage-data':  { 
                    $coverageDataFile =  $option[1 ];   
                case  '--coverage-html':  { 
                    $coverageHTMLFile =  $option[1 ];   
                case  '--coverage-text':  { 
                    $coverageTextFile =  $option[1 ];   
                    exit (self ::SUCCESS_EXIT );  
                    $testdoxHTMLFile =  $option[1 ];   
                    $testdoxTextFile =  $option[1 ];   
                        @include_once(str_replace('_', '/', $option[1 ]) .  '.php');   
                        $class = new ReflectionClass ($option[1 ]);   
                        if ($class->implementsInterface ('PHPUnit2_Runner_TestSuiteLoader') &&   
                            $class->isInstantiable ()) {  
                            $this->loader =  $class->newInstance ();   
                    if ($this->loader === NULL ) {  
                            'Could not use "%s" as loader.',  
                    $xmlLogfile =  $option[1 ];   
                        self ::printVersionString ();  
                            print  $e->getMessage () .  "\n";  
                              "Could not write test class skeleton for %s to %s.\n",  
                            exit (self ::FAILURE_EXIT );  
                          "Wrote test class skeleton for %s to %s.\n",  
                        exit (self ::SUCCESS_EXIT );  
                    self ::printVersionString ();  
                    exit (self ::SUCCESS_EXIT );  
            exit (self ::SUCCESS_EXIT );  
              'Could not create and run test suite: ' .  $e->getMessage ()  
    // {{{ public static function run($test, $coverageDataFile = FALSE, $coverageHTMLFile = FALSE, $coverageTextFile = FALSE, $testdoxHTMLFile = FALSE, $testdoxTextFile = FALSE, $xmlLogfile = FALSE, $wait = FALSE)  
    * @param  mixed   $coverageDataFile   
    * @param  mixed   $testdoxHTMLFile   
    * @param  mixed   $testdoxTextFile   
    * @param  mixed   $xmlLogfile   
    public  static function run($test, $coverageDataFile = FALSE , $coverageHTMLFile = FALSE , $coverageTextFile = FALSE , $testdoxHTMLFile = FALSE , $testdoxTextFile = FALSE , $xmlLogfile = FALSE , $wait = FALSE ) { 
        if ($test instanceof ReflectionClass ) {  
            return $aTestRunner->doRun (  
    // {{{ public static function runAndWait(PHPUnit2_Framework_Test $suite)  
    * Runs a single test and waits until the user types RETURN.  
    * @param  PHPUnit2_Framework_Test $suite   
    public  static function runAndWait(PHPUnit2_Framework_Test  $suite) { 
    // {{{ protected TestResult createTestResult()  
    * @return PHPUnit2_Framework_TestResult   
    // {{{ public function doRun(PHPUnit2_Framework_Test $suite, $coverageDataFile = FALSE, $coverageHTMLFile = FALSE, $coverageTextFile = FALSE, $testdoxHTMLFile = FALSE, $testdoxTextFile = FALSE, $xmlLogfile = FALSE, $wait = FALSE)  
    * @param  PHPUnit2_Framework_Test $suite   
    * @param  mixed                   $coverageDataFile   
    * @param  mixed                   $coverageHTMLFile   
    * @param  mixed                   $coverageTextFile   
    * @param  mixed                   $testdoxHTMLFile   
    * @param  mixed                   $testdoxTextFile   
    * @param  mixed                   $xmlLogfile   
    * @return PHPUnit2_Framework_TestResult   
    public  function doRun(PHPUnit2_Framework_Test  $suite, $coverageDataFile = FALSE , $coverageHTMLFile = FALSE , $coverageTextFile = FALSE , $testdoxHTMLFile = FALSE , $testdoxTextFile = FALSE , $xmlLogfile = FALSE , $wait = FALSE ) { 
        $timer  = new Benchmark_Timer;   
        if ($this->printer === NULL ) {  
        $result->addListener ($this->printer);   
        if ($testdoxHTMLFile !== FALSE ) {  
        if ($testdoxTextFile !== FALSE ) {  
        if ($xmlLogfile !== FALSE ) {  
        $timeElapsed =  $timer->timeElapsed ();   
    // {{{ public function getLoader()  
    * Returns the loader to be used.  
    * @return PHPUnit2_Runner_TestSuiteLoader   
        if ($this->loader === NULL ) {  
    // {{{ protected function handleCodeCoverageInformation(PHPUnit2_Framework_TestResult $result, $coverageDataFile, $coverageHTMLFile, $coverageTextFile)  
    * @param  PHPUnit2_Framework_TestResult $result   
    * @param  mixed                         $coverageDataFile   
    * @param  mixed                         $coverageHTMLFile   
    * @param  mixed                         $coverageTextFile   
    protected  function handleCodeCoverageInformation(PHPUnit2_Framework_TestResult  $result, $coverageDataFile, $coverageHTMLFile, $coverageTextFile) { 
        if ($coverageDataFile !== FALSE &&   
            $fp =  fopen($coverageDataFile, 'w')) {  
        if ($coverageHTMLFile !== FALSE ) {  
              $result->getCodeCoverageInformation ()  
            $renderer->renderToFile ($coverageHTMLFile);   
        if ($coverageTextFile !== FALSE ) {  
              $result->getCodeCoverageInformation ()  
            $renderer->renderToFile ($coverageTextFile);   
    // {{{ public function showError($message)  
        self ::printVersionString ();  
        exit (self ::FAILURE_EXIT );  
    // {{{ public function showHelp()  
        self ::printVersionString ();  
        print  "Usage: phpunit [switches] UnitTest [UnitTest.php]\n";  
            print  "  --coverage-data <file> Write Code Coverage data in raw format to file.\n" .  
                  "  --coverage-html <file> Write Code Coverage data in HTML format to file.\n" .   
                  "  --coverage-text <file> Write Code Coverage data in text format to file.\n\n";   
        print  "  --testdox-html <file>  Log test progress in TestDox/HTML format to file.\n" .  
              "  --testdox-text <file>  Log test progress in TestDox/Text format to file.\n";   
            print  "  --log-xml <file>       Log test progress in XML format to file.\n\n";  
        print  "  --loader <loader>      TestSuiteLoader implementation to use.\n\n" .  
              "  --skeleton             Generate skeleton UnitTest class for Unit in Unit.php.\n\n" .   
              "  --wait                 Waits for a keystroke after each test.\n\n" .   
              "  --help                 Prints this usage information.\n" .   
              "  --version              Prints the version and exits.\n";   
    // {{{ protected function pause($wait)  
    protected  function pause($wait) { 
    // {{{ public function setPrinter(PHPUnit2_TextUI_ResultPrinter $resultPrinter)  
    * @param  PHPUnit2_TextUI_ResultPrinter $resultPrinter   
    public  function setPrinter(PHPUnit2_TextUI_ResultPrinter  $resultPrinter) { 
        $this->printer =  $resultPrinter;   
    // {{{ public function testStarted($testName)  
    * @param  string  $testName   
    // {{{ public function testEnded($testName)  
    * @param  string  $testName   
    // {{{ public function testFailed($status, PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e)  
    * @param  PHPUnit2_Framework_Test                 $test   
    * @param  PHPUnit2_Framework_AssertionFailedError $e   
    public  function testFailed($status, PHPUnit2_Framework_Test  $test, PHPUnit2_Framework_AssertionFailedError  $e) { 
    // {{{ protected function runFailed($message)  
    * Override to define how to handle a failed loading of  
        self ::printVersionString ();  
        exit (self ::FAILURE_EXIT );  
    // {{{ private static function printVersionString()  
    private  static function printVersionString () { 
        if (!self ::$versionStringPrinted) {  
            print PHPUnit2_Runner_Version ::getVersionString () .  "\n\n";  
            self ::$versionStringPrinted = TRUE;  
 * vim600:  et sw=2 ts=2 fdm=marker  
 
 
        
		    
 
		    Documentation generated on Mon, 11 Mar 2019 14:19:19 -0400 by  phpDocumentor 1.4.4. PEAR Logo Copyright ©  PHP Group 2004.
	        
       |