MaxSem has submitted this change and it was merged.
Change subject: Ensures phpunit run from the makefile respects MW_INSTALL_PATH
......................................................................
Ensures phpunit run from the makefile respects MW_INSTALL_PATH
This makes it possible to rely on the makefile for running phpunit tests
in MobileFrontend on setups where MobileFrontend doesn't actually live
in a standard location.
Change-Id: Ie28dc4119b6e6d0a8f7e266db66529b17af55538
---
M Makefile
A tests/bootstrap.php
M tests/mfe.suite.xml
3 files changed, 23 insertions(+), 2 deletions(-)
Approvals:
MaxSem: Verified; Looks good to me, approved
jenkins-bot: Checked
diff --git a/Makefile b/Makefile
index 2efc291..156ead4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+MW_INSTALL_PATH ?= ../..
+
.PHONY: less
jshinttests:
@@ -13,7 +15,7 @@
@scripts/less.sh
phpunit:
- cd ../../tests/phpunit && php phpunit.php --configuration
../../extensions/MobileFrontend/tests/mfe.suite.xml --group=MobileFrontend
+ cd ${MW_INSTALL_PATH}/tests/phpunit && php phpunit.php --configuration
${MW_INSTALL_PATH}/extensions/MobileFrontend/tests/mfe.suite.xml
--group=MobileFrontend
qunit:
@scripts/qunit.sh
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100644
index 0000000..cddd5d5
--- /dev/null
+++ b/tests/bootstrap.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Find the correct path to /tests/phpunit/bootstrap.php in core
+ *
+ * Takes MW_INSTALL_PATH environment variable into account. This is used by the
+ * test suite defined in mfe.suite.xml for MobileFrontend phpunit testing.
+ */
+
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+ if ( realpath( '../..' ) ) {
+ $IP = realpath( '../..' );
+ } else {
+ $IP = dirname( dirname( dirname( __DIR__ ) ) );
+ }
+}
+
+require_once( $IP . "/tests/phpunit/bootstrap.php" );
+
diff --git a/tests/mfe.suite.xml b/tests/mfe.suite.xml
index 4c07a81..274f38b 100644
--- a/tests/mfe.suite.xml
+++ b/tests/mfe.suite.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- colors don't work on Windows! -->
-<phpunit bootstrap="../../../tests/phpunit/bootstrap.php"
+<phpunit bootstrap="bootstrap.php"
colors="true"
backupGlobals="false"
convertErrorsToExceptions="true"
--
To view, visit https://gerrit.wikimedia.org/r/59338
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie28dc4119b6e6d0a8f7e266db66529b17af55538
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: awjrichards <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits