From: Timo Tijhof Date: Sun, 8 Oct 2017 20:17:35 +0000 (+0100) Subject: tests: Commit initial version of DevelopmentSettings.php X-Git-Tag: 1.31.0-rc.0~591^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=fdb7d369035d0826113f9d8b6c3e99a9bba073be;p=lhc%2Fweb%2Fwiklou.git tests: Commit initial version of DevelopmentSettings.php * Store in the includes/ directory. * Use by default in Travis CI builds. * Add command-line option to phpunit.php to use it. * See commit ## for use by Jenkins jobs, which will load it directly from LocalSettings.php (instead of via phpunit) so that it applies to web entry points and other maintenance scripts as well. Bug: T177669 Change-Id: I6e5dc5f0dddc1960761980552ed2bb31e6ae9fd9 --- diff --git a/.travis.yml b/.travis.yml index 64414b5a98..29fb890515 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,6 +67,8 @@ before_script: --dbuser "$dbuser" --dbpass "" --scriptpath "/w" + - echo -en "\n\nrequire_once __DIR__ . '/includes/DevelopmentSettings.php';\n" >> ./LocalSettings.php + - php -l ./LocalSettings.php script: - php tests/phpunit/phpunit.php diff --git a/includes/DevelopmentSettings.php b/includes/DevelopmentSettings.php new file mode 100644 index 0000000000..a74353ab6b --- /dev/null +++ b/includes/DevelopmentSettings.php @@ -0,0 +1,59 @@ +addOption( 'profiler', 'Profiler output format (usually "text")', false, true ); + // This is named --mwdebug, because --debug would conflict in the phpunit.php CLI script. + $this->addOption( 'mwdebug', 'Enable built-in MediaWiki development settings', false, true ); # Save generic options to display them separately in help $this->mGenericParameters = $this->mParams; @@ -1131,6 +1133,11 @@ abstract class Maintenance { MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->destroy(); } + # Apply debug settings + if ( $this->hasOption( 'mwdebug' ) ) { + require __DIR__ . '/../includes/DevelopmentSettings.php'; + } + // Per-script profiling; useful for debugging $this->activateProfiler(); diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 7203777096..a78bd82ce7 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -21,6 +21,7 @@ class PHPUnitMaintClass extends Maintenance { 'use-bagostuff' => false, 'use-jobqueue' => false, 'use-normal-tables' => false, + 'mwdebug' => false, 'reuse-db' => false, 'wiki' => false, 'profiler' => false,