3 * Bootstrapping for MediaWiki PHPUnit tests
4 * This file is included by phpunit and is NOT in the global scope.
9 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
11 You are running these tests directly from phpunit. You may not have all globals correctly set.
12 Running phpunit.php instead is recommended.
14 require_once ( dirname( __FILE__
) . "/phpunit.php" );
17 // Output a notice when running with older versions of PHPUnit
18 if ( !version_compare( PHPUnit_Runner_Version
::id(), "3.4.1", ">" ) ) {
20 ********************************************************************************
22 These tests run best with version PHPUnit 3.4.2 or better. Earlier versions may
23 show failures because earlier versions of PHPUnit do not properly implement
26 ********************************************************************************
31 global $wgLocalisationCacheConf, $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType;
32 global $wgMessageCache, $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry;
33 $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
34 $wgMainCacheType = CACHE_NONE
;
35 $wgMessageCacheType = CACHE_NONE
;
36 $wgParserCacheType = CACHE_NONE
;
37 $wgUseDatabaseMessages = false; # Set for future resets
39 # The message cache was already created in Setup.php
40 $wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache',
41 array( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry ) );
45 abstract class MediaWikiTestSetup
extends PHPUnit_Framework_TestCase
{
48 public $runDisabled = false;
50 function __construct( PHPUnit_Framework_TestSuite
$suite = null ) {
51 if ( null !== $suite ) {
52 $this->suite
= $suite;
56 function __call( $func, $args ) {
57 if ( method_exists( $this->suite
, $func ) ) {
58 return call_user_func_array( array( $this->suite
, $func ), $args);
60 throw new MWException( "Called non-existant $func method on "
61 . get_class( $this ) );