mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-09-23 10:21:11 +00:00
PopupsContext::areDependenciesMet should respect PopupsGateway config
On all wikis Popups use Restbase as default gateway. In that case we do not require the TextExtracts nor PageImages extensions. Code should reflect that. Bug: T190818 Change-Id: If4ce8f709b2ca1bb3cc381afa5e80e978adf2498
This commit is contained in:
parent
1acd15adb1
commit
915a9708fb
|
@ -148,8 +148,12 @@ class PopupsContext {
|
|||
* @return bool
|
||||
*/
|
||||
public function areDependenciesMet() {
|
||||
$areMet = $this->extensionRegistry->isLoaded( 'TextExtracts' )
|
||||
$areMet = true;
|
||||
|
||||
if ( $this->config->get( 'PopupsGateway' ) === 'mwApiPlain' ) {
|
||||
$areMet = $areMet && $this->extensionRegistry->isLoaded( 'TextExtracts' )
|
||||
&& $this->extensionRegistry->isLoaded( 'PageImages' );
|
||||
}
|
||||
|
||||
if ( $this->isBetaFeatureEnabled() ) {
|
||||
$areMet = $areMet && $this->extensionRegistry->isLoaded( 'BetaFeatures' );
|
||||
|
|
|
@ -203,9 +203,10 @@ class PopupsContextTest extends MediaWikiTestCase {
|
|||
* @param bool $expected
|
||||
*/
|
||||
public function testAreDependenciesMet( $betaOn, $textExtracts, $pageImages,
|
||||
$betaFeatures, $expected ) {
|
||||
$betaFeatures, $gateway, $expected ) {
|
||||
$this->setMwGlobals( [
|
||||
"wgPopupsBetaFeature" => $betaOn
|
||||
"wgPopupsBetaFeature" => $betaOn,
|
||||
"wgPopupsGateway" => $gateway,
|
||||
] );
|
||||
$returnValues = [ $textExtracts, $pageImages, $betaFeatures ];
|
||||
|
||||
|
@ -228,6 +229,7 @@ class PopupsContextTest extends MediaWikiTestCase {
|
|||
"textExtracts" => true,
|
||||
"pageImages" => true,
|
||||
"betaFeatures" => false,
|
||||
"gateway" => "mwApiPlain",
|
||||
"expected" => true
|
||||
],
|
||||
// textExtracts dep is missing
|
||||
|
@ -236,6 +238,7 @@ class PopupsContextTest extends MediaWikiTestCase {
|
|||
"textExtracts" => false,
|
||||
"pageImages" => true,
|
||||
"betaFeatures" => false,
|
||||
"gateway" => "mwApiPlain",
|
||||
"expected" => false
|
||||
],
|
||||
// PageImages dep is missing
|
||||
|
@ -244,6 +247,7 @@ class PopupsContextTest extends MediaWikiTestCase {
|
|||
"textExtracts" => true,
|
||||
"pageImages" => false,
|
||||
"betaFeatures" => false,
|
||||
"gateway" => "mwApiPlain",
|
||||
"expected" => false
|
||||
],
|
||||
// Beta is on but BetaFeatures dep is missing
|
||||
|
@ -252,6 +256,7 @@ class PopupsContextTest extends MediaWikiTestCase {
|
|||
"textExtracts" => true,
|
||||
"pageImages" => true,
|
||||
"betaFeatures" => false,
|
||||
"gateway" => "mwApiPlain",
|
||||
"expected" => false
|
||||
],
|
||||
// beta is on and all deps are available
|
||||
|
@ -260,8 +265,18 @@ class PopupsContextTest extends MediaWikiTestCase {
|
|||
"textExtracts" => true,
|
||||
"pageImages" => true,
|
||||
"betaFeatures" => true,
|
||||
"gateway" => "mwApiPlain",
|
||||
"expected" => true
|
||||
]
|
||||
],
|
||||
// when Popups uses gateway!=mwApiPlain we don't require PageImages nor TextExtracts
|
||||
[
|
||||
"betaOn" => false,
|
||||
"textExtracts" => false,
|
||||
"pageImages" => false,
|
||||
"betaFeatures" => false,
|
||||
"gateway" => "restbaseHTML",
|
||||
"expected" => true
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue