From: Trevor Parscal Date: Wed, 29 Sep 2010 18:02:56 +0000 (+0000) Subject: Added support for PHPUnit 3.5, where PHPUnit_Util_Timer is replaced with PHP_Timer. X-Git-Tag: 1.31.0-rc.0~34743 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=6d9faa3ca3b87b450fafd71b6aaab0bdb65db371;p=lhc%2Fweb%2Fwiklou.git Added support for PHPUnit 3.5, where PHPUnit_Util_Timer is replaced with PHP_Timer. --- diff --git a/maintenance/tests/phpunit/includes/parser/ParserHelpers.php b/maintenance/tests/phpunit/includes/parser/ParserHelpers.php index 893bf8b420..165b93d9b2 100644 --- a/maintenance/tests/phpunit/includes/parser/ParserHelpers.php +++ b/maintenance/tests/phpunit/includes/parser/ParserHelpers.php @@ -19,7 +19,13 @@ class ParserUnitTest extends PHPUnit_Framework_TestCase { $backend = $this->suite->getBackend(); $result->startTest( $this ); - PHPUnit_Util_Timer::start(); + + // Support the transition to PHPUnit 3.5 where PHPUnit_Util_Timer is replaced with PHP_Timer + if ( class_exists( 'PHP_Timer' ) ) { + PHP_Timer::start(); + } else { + PHPUnit_Util_Timer::start(); + } $r = false; try { @@ -35,13 +41,29 @@ class ParserUnitTest extends PHPUnit_Framework_TestCase { ); } catch ( PHPUnit_Framework_AssertionFailedError $e ) { - $result->addFailure( $this, $e, PHPUnit_Util_Timer::stop() ); + + // PHPUnit_Util_Timer -> PHP_Timer support (see above) + if ( class_exists( 'PHP_Timer' ) ) { + $result->addFailure( $this, $e, PHP_Timer::stop() ); + } else { + $result->addFailure( $this, $e, PHPUnit_Util_Timer::stop() ); + } } catch ( Exception $e ) { - $result->addError( $this, $e, PHPUnit_Util_Timer::stop() ); + // PHPUnit_Util_Timer -> PHP_Timer support (see above) + if ( class_exists( 'PHP_Timer' ) ) { + $result->addFailure( $this, $e, PHP_Timer::stop() ); + } else { + $result->addFailure( $this, $e, PHPUnit_Util_Timer::stop() ); + } } - $result->endTest( $this, PHPUnit_Util_Timer::stop() ); + // PHPUnit_Util_Timer -> PHP_Timer support (see above) + if ( class_exists( 'PHP_Timer' ) ) { + $result->endTest( $this, PHP_Timer::stop() ); + } else { + $result->endTest( $this, PHPUnit_Util_Timer::stop() ); + } $backend->recorder->record( $this->test['test'], $r ); $this->addToAssertionCount( PHPUnit_Framework_Assert::getCount() );