http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73964

Revision: 73964
Author:   tparscal
Date:     2010-09-29 18:02:56 +0000 (Wed, 29 Sep 2010)

Log Message:
-----------
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: 
trunk/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php
===================================================================
--- trunk/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php    
2010-09-29 18:00:44 UTC (rev 73963)
+++ trunk/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php    
2010-09-29 18:02:56 UTC (rev 73964)
@@ -19,7 +19,13 @@
 
                $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 @@
                        );
                }
                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() );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to