r73964 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73963‎ | r73964 | r73965 >
Date:18:02, 29 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Added support for PHPUnit 3.5, where PHPUnit_Util_Timer is replaced with PHP_Timer.
Modified paths:
  • /trunk/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php
@@ -19,7 +19,13 @@
2020
2121 $backend = $this->suite->getBackend();
2222 $result->startTest( $this );
23 - PHPUnit_Util_Timer::start();
 23+
 24+ // Support the transition to PHPUnit 3.5 where PHPUnit_Util_Timer is replaced with PHP_Timer
 25+ if ( class_exists( 'PHP_Timer' ) ) {
 26+ PHP_Timer::start();
 27+ } else {
 28+ PHPUnit_Util_Timer::start();
 29+ }
2430
2531 $r = false;
2632 try {
@@ -35,13 +41,29 @@
3642 );
3743 }
3844 catch ( PHPUnit_Framework_AssertionFailedError $e ) {
39 - $result->addFailure( $this, $e, PHPUnit_Util_Timer::stop() );
 45+
 46+ // PHPUnit_Util_Timer -> PHP_Timer support (see above)
 47+ if ( class_exists( 'PHP_Timer' ) ) {
 48+ $result->addFailure( $this, $e, PHP_Timer::stop() );
 49+ } else {
 50+ $result->addFailure( $this, $e, PHPUnit_Util_Timer::stop() );
 51+ }
4052 }
4153 catch ( Exception $e ) {
42 - $result->addError( $this, $e, PHPUnit_Util_Timer::stop() );
 54+ // PHPUnit_Util_Timer -> PHP_Timer support (see above)
 55+ if ( class_exists( 'PHP_Timer' ) ) {
 56+ $result->addFailure( $this, $e, PHP_Timer::stop() );
 57+ } else {
 58+ $result->addFailure( $this, $e, PHPUnit_Util_Timer::stop() );
 59+ }
4360 }
4461
45 - $result->endTest( $this, PHPUnit_Util_Timer::stop() );
 62+ // PHPUnit_Util_Timer -> PHP_Timer support (see above)
 63+ if ( class_exists( 'PHP_Timer' ) ) {
 64+ $result->endTest( $this, PHP_Timer::stop() );
 65+ } else {
 66+ $result->endTest( $this, PHPUnit_Util_Timer::stop() );
 67+ }
4668
4769 $backend->recorder->record( $this->test['test'], $r );
4870 $this->addToAssertionCount( PHPUnit_Framework_Assert::getCount() );

Status & tagging log