Index: trunk/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php |
— | — | @@ -19,7 +19,13 @@ |
20 | 20 | |
21 | 21 | $backend = $this->suite->getBackend(); |
22 | 22 | $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 | + } |
24 | 30 | |
25 | 31 | $r = false; |
26 | 32 | try { |
— | — | @@ -35,13 +41,29 @@ |
36 | 42 | ); |
37 | 43 | } |
38 | 44 | 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 | + } |
40 | 52 | } |
41 | 53 | 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 | + } |
43 | 60 | } |
44 | 61 | |
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 | + } |
46 | 68 | |
47 | 69 | $backend->recorder->record( $this->test['test'], $r ); |
48 | 70 | $this->addToAssertionCount( PHPUnit_Framework_Assert::getCount() ); |