mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-23 15:56:50 +00:00
Unset CaptchaStore instance before test
Caught while tests were running for core. Fatal error: Call to undefined method CaptchaSessionStore::clearAll() in ConfirmEdit/tests/CaptchaAuthenticationRequestTest.php on line 13 Change-Id: I3a9f5b315eb114cb12ea4071f8da9079f797fcf6
This commit is contained in:
parent
d1ef7ab717
commit
eedab34d3d
|
@ -53,6 +53,13 @@ abstract class CaptchaStore {
|
|||
return self::$instance;
|
||||
}
|
||||
|
||||
final public static function unsetInstanceForTests() {
|
||||
if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
|
||||
throw new MWException( 'Cannot unset ' . __CLASS__ . ' instance in operation.' );
|
||||
}
|
||||
self::$instance = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected constructor: no creating instances except through the factory method above
|
||||
*/
|
||||
|
|
|
@ -10,6 +10,7 @@ class CaptchaAuthenticationRequestTest extends AuthenticationRequestTestCase {
|
|||
'wgCaptchaClass' => 'SimpleCaptcha',
|
||||
'wgCaptchaStorageClass' => CaptchaHashStore::class,
|
||||
] );
|
||||
CaptchaStore::unsetInstanceForTests();
|
||||
CaptchaStore::get()->clearAll();
|
||||
CaptchaStore::get()->store( '345', [ 'question' => '2+2', 'answer' => '4' ] );
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
'wgCaptchaStorageClass' => CaptchaHashStore::class,
|
||||
'wgMainCacheType' => __METHOD__,
|
||||
] );
|
||||
CaptchaStore::unsetInstanceForTests();
|
||||
CaptchaStore::get()->clearAll();
|
||||
ObjectCache::$instances[__METHOD__] = new HashBagOStuff();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue