X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fphpunit.php;h=baaa66bca222a80d9225f03b8a9977ba03604dc2;hb=a3f450851a07340cb6264808e02a6c046e32d2dc;hp=77690cdd292947ffcb394a8787c8480b23792e4c;hpb=6a4214dc89ced2563755fa4ba25d0ed3ad22550d;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 77690cdd29..baaa66bca2 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -75,8 +75,9 @@ class PHPUnitMaintClass extends Maintenance { global $wgLanguageConverterCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; global $wgDevelopmentWarnings; - global $wgSessionProviders; + global $wgSessionProviders, $wgSessionPbkdf2Iterations; global $wgJobTypeConf; + global $wgAuthManagerConfig, $wgAuth, $wgDisableAuthManager; // Inject test autoloader require_once __DIR__ . '/../TestsAutoLoader.php'; @@ -124,6 +125,30 @@ class PHPUnitMaintClass extends Maintenance { ], ]; + // Single-iteration PBKDF2 session secret derivation, for speed. + $wgSessionPbkdf2Iterations = 1; + + // Generic AuthManager configuration for testing + $wgAuthManagerConfig = [ + 'preauth' => [], + 'primaryauth' => [ + [ + 'class' => MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider::class, + 'args' => [ [ + 'authoritative' => false, + ] ], + ], + [ + 'class' => MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider::class, + 'args' => [ [ + 'authoritative' => true, + ] ], + ], + ], + 'secondaryauth' => [], + ]; + $wgAuth = $wgDisableAuthManager ? new AuthPlugin : new MediaWiki\Auth\AuthManagerAuthPlugin(); + // Bug 44192 Do not attempt to send a real e-mail Hooks::clear( 'AlternateUserMailer' ); Hooks::register( @@ -139,6 +164,10 @@ class PHPUnitMaintClass extends Maintenance { // may break testing against floating point values // treated with PHP's serialize() ini_set( 'serialize_precision', 17 ); + + // TODO: we should call MediaWikiTestCase::prepareServices( new GlobalVarConfig() ) here. + // But PHPUnit may not be loaded yet, so we have to wait until just + // before PHPUnit_TextUI_Command::main() is executed at the end of this file. } public function execute() { @@ -237,4 +266,9 @@ echo defined( 'HHVM_VERSION' ) ? 'Using HHVM ' . HHVM_VERSION . ' (' . PHP_VERSION . ")\n" : 'Using PHP ' . PHP_VERSION . "\n"; +// Prepare global services for unit tests. +// FIXME: this should be done in the finalSetup() method, +// but PHPUnit may not have been loaded at that point. +MediaWikiTestCase::prepareServices( new GlobalVarConfig() ); + $wgPhpUnitClass::main();