mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-13 17:57:06 +00:00
tests: Use fresh RequestContext in FeatureManagerTest
RequestContext::getMain() is global state and should not be used by unit tests Change-Id: I8ea64ebc4c83b909b4d397532b7dba4ebf9a9f07
This commit is contained in:
parent
74f72ecf7d
commit
03634118e3
|
@ -41,7 +41,7 @@ class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
$featureManager = new FeatureManager(
|
||||
$this->createMock( UserOptionsLookup::class ),
|
||||
RequestContext::getMain()
|
||||
new RequestContext()
|
||||
);
|
||||
$featureManager->registerSimpleRequirement( 'requirementA', true );
|
||||
$featureManager->registerSimpleRequirement( 'requirementA', true );
|
||||
|
@ -75,7 +75,7 @@ class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
$featureManager = new FeatureManager(
|
||||
$this->createMock( UserOptionsLookup::class ),
|
||||
RequestContext::getMain()
|
||||
new RequestContext()
|
||||
);
|
||||
$featureManager->registerSimpleRequirement( 'requirement', true );
|
||||
$featureManager->registerFeature( 'feature', $config );
|
||||
|
@ -87,7 +87,7 @@ class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
|||
public function testIsRequirementMet() {
|
||||
$featureManager = new FeatureManager(
|
||||
$this->createMock( UserOptionsLookup::class ),
|
||||
RequestContext::getMain()
|
||||
new RequestContext()
|
||||
);
|
||||
$featureManager->registerSimpleRequirement( 'enabled', true );
|
||||
$featureManager->registerSimpleRequirement( 'disabled', false );
|
||||
|
@ -104,7 +104,7 @@ class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
$featureManager = new FeatureManager(
|
||||
$this->createMock( UserOptionsLookup::class ),
|
||||
RequestContext::getMain()
|
||||
new RequestContext()
|
||||
);
|
||||
$featureManager->isRequirementMet( 'foo' );
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
$featureManager = new FeatureManager(
|
||||
$this->createMock( UserOptionsLookup::class ),
|
||||
RequestContext::getMain()
|
||||
new RequestContext()
|
||||
);
|
||||
$featureManager->registerFeature( 'featureA', [] );
|
||||
$featureManager->registerFeature( 'featureA', [] );
|
||||
|
@ -129,7 +129,7 @@ class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
|||
public function testIsFeatureEnabled() {
|
||||
$featureManager = new FeatureManager(
|
||||
$this->createMock( UserOptionsLookup::class ),
|
||||
RequestContext::getMain()
|
||||
new RequestContext()
|
||||
);
|
||||
$featureManager->registerSimpleRequirement( 'foo', false );
|
||||
$featureManager->registerFeature( 'requiresFoo', 'foo' );
|
||||
|
@ -163,7 +163,7 @@ class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
$featureManager = new FeatureManager(
|
||||
$this->createMock( UserOptionsLookup::class ),
|
||||
RequestContext::getMain()
|
||||
new RequestContext()
|
||||
);
|
||||
$featureManager->isFeatureEnabled( 'foo' );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue