Version: current

# Class SapphireTestReporter

Gathers details about PHPUnit2 test suites as they are been executed. This does not actually format any output but simply gathers extended information about the overall results of all suites & their tests for use elsewhere.

Changelog: 0.6 First created [David Spurr] 0.7 Added fix to getTestException provided [Glen Ogilvie]

  SapphireTestReporter implements PHPUnit_Framework_TestListener

### Direct known subclasses

`CliTestReporter`

Package: sapphire\testing
Author: David Spurr
Version: 0.7 2006-03-12
Located at sapphire/dev/SapphireTestReporter.php

## Methods summary

`public` | # `__construct( )` Constructor, checks to see availability of PEAR Benchmark_Timer and sets up basic properties Constructor, checks to see availability of PEAR Benchmark_Timer and sets up basic properties
`public array` | # `getSuiteResults( )` Returns the suite results Returns the suite results #### Returns `array` Suite results
`public` | # `startTestSuite( PHPUnit_Framework_TestSuite $suite )` Sets up the container for result details of the current test suite when each suite is first run Sets up the container for result details of the current test suite when each suite is first run #### Parameters $suite obj PHPUnit2_Framework_TestSuite, the suite that is been run
`public` | # `startTest( PHPUnit_Framework_Test $test )` Sets up the container for result details of the current test when each test is first run Sets up the container for result details of the current test when each test is first run #### Parameters $test obj PHPUnit_Framework_Test, the test that is being run
`public` | # `addFailure( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, mixed $time )` Adds the failure detail to the current test and increases the failure count for the current suite Adds the failure detail to the current test and increases the failure count for the current suite #### Parameters $test obj PHPUnit_Framework_Test, current test that is being run $e obj PHPUnit_Framework_AssertationFailedError, PHPUnit error $time
`public` | # `addError( PHPUnit_Framework_Test $test, `Exception` $e, mixed $time )` Adds the error detail to the current test and increases the error count for the current suite Adds the error detail to the current test and increases the error count for the current suite #### Parameters $test obj PHPUnit_Framework_Test, current test that is being run $e obj PHPUnit_Framework_AssertationFailedError, PHPUnit error $time
`public` | # `addIncompleteTest( PHPUnit_Framework_Test $test, `Exception` $e, mixed $time )` Adds the test incomplete detail to the current test and increases the incomplete count for the current suite Adds the test incomplete detail to the current test and increases the incomplete count for the current suite #### Parameters $test obj PHPUnit_Framework_Test, current test that is being run $e obj PHPUnit_Framework_AssertationFailedError, PHPUnit error $time
`public` | # `addSkippedTest( PHPUnit_Framework_Test $test, `Exception` $e, mixed $time )` Not used Not used #### Parameters $test PHPUnit_Framework_Test $test $e unknown_type $time $time
`public` | # `endTest( PHPUnit_Framework_Test $test, mixed $time )` Upon completion of a test, records the execution time (if available) and adds the test to the tests performed in the current suite. Upon completion of a test, records the execution time (if available) and adds the test to the tests performed in the current suite. #### Parameters $test obj PHPUnit_Framework_Test, current test that is being run $time
`public` | # `endTestSuite( PHPUnit_Framework_TestSuite $suite )` Upon completion of a test suite adds the suite to the suties performed Upon completion of a test suite adds the suite to the suties performed #### Parameters $suite obj PHPUnit_Framework_TestSuite, current suite that is being run
`public` | # `writeResults( )` Display error bar if it exists Display error bar if it exists
`protected` | # `testNameToPhrase( mixed $name )`

### Magic methods summary

## Properties summary

`protected array` | $suiteResults | # Holds array of suites and total number of tests run Holds array of suites and total number of tests run
`protected array` | $currentSuite | # Holds data of current suite that is been run Holds data of current suite that is been run
`protected array` | $currentTest | # Holds data of current test that is been run Holds data of current test that is been run
`protected boolean` | $hasTimer | # Whether PEAR Benchmark_Timer is available for timing Whether PEAR Benchmark_Timer is available for timing
`protected obj` | $timer | # Holds the PEAR Benchmark_Timer object Holds the PEAR Benchmark_Timer object
`protected mixed` | $startTestTime | #
`protected array` | $testSpeeds | # An array of all the test speeds An array of all the test speeds

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -