3 class ParserUnitTest
extends PHPUnit_Framework_TestCase
{
7 public function __construct( $suite, $test = null ) {
12 function count() { return 1; }
14 public function run( PHPUnit_Framework_TestResult
$result = null ) {
15 PHPUnit_Framework_Assert
::resetCount();
16 if ( $result === NULL ) {
17 $result = new PHPUnit_Framework_TestResult
;
20 $backend = $this->suite
->getBackend();
21 $result->startTest( $this );
22 PHPUnit_Util_Timer
::start();
27 # On failure, the subclassed backend will throw an exception with
29 $r = $backend->runTest(
32 $this->test
['result'],
33 $this->test
['options'],
37 catch ( PHPUnit_Framework_AssertionFailedError
$e ) {
38 $result->addFailure( $this, $e, PHPUnit_Util_Timer
::stop() );
40 catch ( Exception
$e ) {
41 $result->addError( $this, $e, PHPUnit_Util_Timer
::stop() );
44 $result->endTest( $this, PHPUnit_Util_Timer
::stop() );
46 $backend->recorder
->record( $this->test
['test'], $r );
47 $this->addToAssertionCount( PHPUnit_Framework_Assert
::getCount() );
52 public function toString() {
53 return $this->test
['test'];
58 class ParserTestSuiteBackend
extends ParserTest
{
59 function showTesting( $desc ) {
62 function showRunFile( $path ) {
65 function showSuccess( $desc ) {
66 PHPUnit_Framework_Assert
::assertTrue( true, $desc );
70 function showFailure( $desc, $expected, $got ) {
71 PHPUnit_Framework_Assert
::assertEquals( $expected, $got, $desc );
74 public function setupRecorder( $options ) {
75 $this->recorder
= new PHPUnitTestRecorder( $this );
79 class PHPUnitTestRecorder
extends TestRecorder
{
80 function record( $test, $result ) {
82 $this->success +
= $result;
86 function reportPercentage( $success, $total ) { }