jenkins-bot has submitted this change and it was merged.

Change subject: Fix some known issues with running PHPUnit in a multiwiki 
context
......................................................................


Fix some known issues with running PHPUnit in a multiwiki context

* Bootstrap MWMultiVersion when MW_PHPUNIT_TEST is defined
* Install phpunit globally with role::payments

Bug: T130171
Change-Id: I82a5610a7f4eee7193509097a204a74d2b6c3acf
---
M puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
M puppet/modules/payments/manifests/init.pp
2 files changed, 13 insertions(+), 1 deletion(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb 
b/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
index 9ebe940..d7c518f 100644
--- a/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
+++ b/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
@@ -1,5 +1,6 @@
 <?php
 // This file is managed by Puppet.
+// See puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
 
 if ( PHP_SAPI !== 'cli' ) {
        header( 'Cache-control: no-cache' );
@@ -12,6 +13,13 @@
 // Load config so we can check for the number of available wikis below
 include_once __DIR__ . '/LoadWgConf.php';
 
+if ( defined( 'MW_PHPUNIT_TEST' ) ) {
+       // Bootstrap multiversion when running unit tests
+       // Needs to happen before MWMultiVersion + db count check
+       require_once '<%= @script_dir %>/MWMultiVersion.php';
+       MWMultiVersion::initializeForMaintenance();
+}
+
 if ( !class_exists( 'MWMultiVersion' ) && count( $wgLocalDatabases ) > 1 ) {
        // T123143: Require mwscript for running scripts on wikifarm
        echo "The mwscript command must be used in multiwiki setups.\n\n";
@@ -20,10 +28,11 @@
        exit(1);
 }
 
+// Ensure that MWMultiVersion has been loaded
 require_once '<%= @script_dir %>/MWMultiVersion.php';
 $multiVersion = MWMultiVersion::getInstance();
 if ( $multiVersion === null ) {
-               $multiVersion = MWMultiVersion::initializeForWiki( '<%= 
scope['::mediawiki::db_name'] %>' );
+       $multiVersion = MWMultiVersion::initializeForWiki( '<%= 
scope['::mediawiki::db_name'] %>' );
 }
 
 $wgHooks['wfShellWikiCmd'][] = 'MWMultiVersion::onWfShellMaintenanceCmd';
diff --git a/puppet/modules/payments/manifests/init.pp 
b/puppet/modules/payments/manifests/init.pp
index 01147f6..fe4f423 100644
--- a/puppet/modules/payments/manifests/init.pp
+++ b/puppet/modules/payments/manifests/init.pp
@@ -23,6 +23,9 @@
 ) {
   include ::payments::donation_interface
 
+  # TODO: This can be removed once we've upgraded to MediaWiki 1.27
+  require_package('phpunit')
+
   git::clone { 'mediawiki-core-fr':
     remote    => 'https://gerrit.wikimedia.org/r/p/mediawiki/core.git',
     directory => $dir,

-- 
To view, visit https://gerrit.wikimedia.org/r/278050
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I82a5610a7f4eee7193509097a204a74d2b6c3acf
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Dduvall <[email protected]>
Gerrit-Reviewer: Eileen <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: Pcoombe <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to