diff options
author | Kosta Harlan <kharlan@wikimedia.org> | 2019-06-25 22:33:14 -0400 |
---|---|---|
committer | Kosta Harlan <kharlan@wikimedia.org> | 2019-06-28 12:18:18 -0400 |
commit | 214750d8d224fc7e79d63536915d0dbba9fe969a (patch) | |
tree | 9e58ab554a4fddd88a958b7b66a750e0f964dddc | |
parent | 1e8a3eff9fbc99841e1b294abbc4184db9c44083 (diff) | |
download | mediawikicore-214750d8d224fc7e79d63536915d0dbba9fe969a.tar.gz mediawikicore-214750d8d224fc7e79d63536915d0dbba9fe969a.zip |
Define unit and integration test suites
Following discussion in Ibb8175981092d7f41864e641cc3c118af70a5c76, this patch
proposes to further reduce the scope of what unit tests may access, by removing
the loading of DefaultSettings and GlobalFunctions.php. This also has the
implied effect of disabling the storage backend, as well as the global service
locator.
MediaWikiTestCase is renamed to MediaWikiIntegrationTestCase so it's scope and
purpose is more clear. Whether we still need to keep `@group Database`
annotation around is debatable, as it's unclear to me what the performance costs
are of implying database access for all tests which extend IntegrationTestCase.
As far as I can tell, `@group Database` is primarily used in CI to run faster
tests before slower ones, and with the new UnitTestCase the annotation seems
redundant.
To run all testsuites, use `composer phpunit`. Other composer scripts:
- `composer phpunit:unit` to run unit tests
- `composer phpunit:integration` to run integration tests
- `composer phpunit:coverage` to generate code coverage reports from unit
tests (requires XDebug).
Note that you can pass arguments to composer scripts with `--`, e.g. `composer
phpunit:integration --exclude-group Dump`.
Other changes:
- Rename bootstrap.php to bootstrap.maintenance.php so it's clear it's part of
the legacy PHPUnit-as-maintenance-class setup
- Create new bootstrap.php which loads the minimal configuration necessary for
the tests, and do additional setup in the run() method of the unit/integration
test case classes
- Move the unit-tests.xml file to phpunit.xml.dist in preparation for this being
the default test configuration
For a follow-up patch:
- Find unit/integration tests for extensions/skins
- Migrate other test suites from suite.xml
- Support running all tests via vendor/bin/phpunit
Bug: T84948
Bug: T89432
Bug: T87781
Change-Id: Ie717b0ecf4fcfd089d46248f14853c80b7ef4a76
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .phpcs.xml | 1 | ||||
-rw-r--r-- | composer.json | 6 | ||||
-rw-r--r-- | includes/DefaultSettings.php | 2 | ||||
-rw-r--r-- | includes/Setup.php | 4 | ||||
-rw-r--r-- | maintenance/findHooks.php | 2 | ||||
-rw-r--r-- | phpunit.xml.dist | 62 | ||||
-rw-r--r-- | tests/common/TestsAutoLoader.php | 3 | ||||
-rw-r--r-- | tests/phpunit/MediaWikiIntegrationTestCase.php (renamed from tests/phpunit/MediaWikiTestCase.php) | 24 | ||||
-rw-r--r-- | tests/phpunit/MediaWikiUnitTestCase.php | 8 | ||||
-rw-r--r-- | tests/phpunit/bootstrap.maintenance.php | 34 | ||||
-rw-r--r-- | tests/phpunit/bootstrap.php | 85 | ||||
-rw-r--r-- | tests/phpunit/integration/includes/db/DatabaseSqliteTest.php (renamed from tests/phpunit/includes/db/DatabaseSqliteTest.php) | 2 | ||||
-rw-r--r-- | tests/phpunit/suite.xml | 2 | ||||
-rw-r--r-- | tests/phpunit/unit-tests.xml | 42 | ||||
-rw-r--r-- | tests/phpunit/unit/initUnitTests.php | 69 |
17 files changed, 201 insertions, 148 deletions
diff --git a/.gitattributes b/.gitattributes index 81b7a331730f..145caeb3b811 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,4 +10,4 @@ package.json export-ignore README.mediawiki export-ignore Gemfile* export-ignore vendor/pear/net_smtp/README.rst export-ignore - +phpunit.xml.dist export-ignore diff --git a/.gitignore b/.gitignore index 8cacb1ee30ff..a76270e184a4 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ npm-debug.log node_modules/ /resources/lib/.foreign /tests/phpunit/phpunit.phar +phpunit.xml /tests/selenium/log .eslintcache diff --git a/.phpcs.xml b/.phpcs.xml index 9ccf5657b778..76234a2b5695 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -180,6 +180,7 @@ <!-- Skip violations in some tests for now --> <exclude-pattern>*/tests/phpunit/includes/GlobalFunctions/*\.php</exclude-pattern> <exclude-pattern>*/tests/phpunit/maintenance/*\.php</exclude-pattern> + <exclude-pattern>*/tests/phpunit/integration/includes/GlobalFunctions/*\.php</exclude-pattern> </rule> <rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound"> diff --git a/composer.json b/composer.json index 428c1a8033a6..df516215e62f 100644 --- a/composer.json +++ b/composer.json @@ -116,7 +116,11 @@ "test": [ "composer lint", "composer phpcs" - ] + ], + "phpunit": "vendor/bin/phpunit", + "phpunit:unit": "vendor/bin/phpunit --colors=always --testsuite=unit", + "phpunit:integration": "vendor/bin/phpunit --colors=always --testsuite=integration", + "phpunit:coverage": "php -d zend_extensions=xdebug.so vendor/bin/phpunit --testsuite=unit --exclude-group Dump,Broken,ParserFuzz,Stub" }, "config": { "optimize-autoloader": true, diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 10155f6f4547..a32af365d03c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -7425,7 +7425,7 @@ $wgSpecialPages = []; /** * Array mapping class names to filenames, for autoloading. */ -$wgAutoloadClasses = []; +$wgAutoloadClasses = $wgAutoloadClasses ?? []; /** * Switch controlling legacy case-insensitive classloading. diff --git a/includes/Setup.php b/includes/Setup.php index 54e679541486..641f1f903035 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -807,7 +807,9 @@ if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) { // Useful debug output if ( $wgCommandLineMode ) { - wfDebug( "\n\nStart command line script $self\n" ); + if ( isset( $self ) ) { + wfDebug( "\n\nStart command line script $self\n" ); + } } else { $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n"; diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php index a90239739117..6d5dda1bfca5 100644 --- a/maintenance/findHooks.php +++ b/maintenance/findHooks.php @@ -82,7 +82,7 @@ class FindHooks extends Maintenance { "$IP/", ]; $extraFiles = [ - "$IP/tests/phpunit/MediaWikiTestCase.php", + "$IP/tests/phpunit/MediaWikiIntegrationTestCase.php", ]; foreach ( $recurseDirs as $dir ) { diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000000..e160f3b2accf --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit bootstrap="tests/phpunit/bootstrap.php" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" + + colors="true" + backupGlobals="false" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + forceCoversAnnotation="true" + stopOnFailure="false" + timeoutForSmallTests="10" + timeoutForMediumTests="30" + timeoutForLargeTests="60" + beStrictAboutTestsThatDoNotTestAnything="true" + beStrictAboutOutputDuringTests="true" + beStrictAboutTestSize="true" + verbose="false"> + <php> + <ini name="memory_limit" value="512M" /> + </php> + <testsuites> + <testsuite name="unit"> + <directory>tests/phpunit/unit</directory> + </testsuite> + <testsuite name="integration"> + <directory>tests/phpunit/integration</directory> + </testsuite> + </testsuites> + <groups> + <exclude> + <group>Broken</group> + </exclude> + </groups> + <filter> + <whitelist addUncoveredFilesFromWhitelist="true"> + <directory suffix=".php">includes</directory> + <directory suffix=".php">languages</directory> + <directory suffix=".php">maintenance</directory> + <exclude> + <directory suffix=".php">languages/messages</directory> + <file>languages/data/normalize-ar.php</file> + <file>languages/data/normalize-ml.php</file> + </exclude> + </whitelist> + </filter> + <listeners> + <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener"> + <arguments> + <array> + <element key="slowThreshold"> + <integer>50</integer> + </element> + <element key="reportLength"> + <integer>50</integer> + </element> + </array> + </arguments> + </listener> + </listeners> +</phpunit> diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php index 8b6c6d5da388..e1dde22436f0 100644 --- a/tests/common/TestsAutoLoader.php +++ b/tests/common/TestsAutoLoader.php @@ -59,8 +59,9 @@ $wgAutoloadClasses += [ 'MediaWikiPHPUnitCommand' => "$testDir/phpunit/MediaWikiPHPUnitCommand.php", 'MediaWikiPHPUnitResultPrinter' => "$testDir/phpunit/MediaWikiPHPUnitResultPrinter.php", 'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php", - 'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiTestCase.php", + 'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiIntegrationTestCase.php", 'MediaWikiUnitTestCase' => "$testDir/phpunit/MediaWikiUnitTestCase.php", + 'MediaWikiIntegrationTestCase' => "$testDir/phpunit/MediaWikiIntegrationTestCase.php", 'MediaWikiTestResult' => "$testDir/phpunit/MediaWikiTestResult.php", 'MediaWikiTestRunner' => "$testDir/phpunit/MediaWikiTestRunner.php", 'PHPUnit4And6Compat' => "$testDir/phpunit/PHPUnit4And6Compat.php", diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiIntegrationTestCase.php index d46a4da01d28..999ba47a427e 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiIntegrationTestCase.php @@ -13,8 +13,14 @@ use Wikimedia\TestingAccessWrapper; /** * @since 1.18 + * + * Extend this class if you are testing classes which access global variables, methods, services + * or a storage backend. + * + * Consider using MediaWikiUnitTestCase and mocking dependencies if your code uses dependency + * injection and does not access any globals. */ -abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { +abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { use MediaWikiCoversValidator; use PHPUnit4And6Compat; @@ -160,8 +166,22 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { } } + private static function initializeForStandardPhpunitEntrypointIfNeeded() { + if ( function_exists( 'wfRequireOnceInGlobalScope' ) ) { + $IP = realpath( __DIR__ . '/../..' ); + wfRequireOnceInGlobalScope( "$IP/includes/Defines.php" ); + wfRequireOnceInGlobalScope( "$IP/includes/DefaultSettings.php" ); + wfRequireOnceInGlobalScope( "$IP/includes/GlobalFunctions.php" ); + wfRequireOnceInGlobalScope( "$IP/includes/Setup.php" ); + wfRequireOnceInGlobalScope( "$IP/tests/common/TestsAutoLoader.php" ); + TestSetup::applyInitialConfig(); + } + } + public static function setUpBeforeClass() { parent::setUpBeforeClass(); + \PHPUnit\Framework\Assert::assertFileExists( 'LocalSettings.php' ); + self::initializeForStandardPhpunitEntrypointIfNeeded(); // Get the original service locator if ( !self::$originalServices ) { @@ -2522,3 +2542,5 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { ) ); } } + +class_alias( 'MediaWikiIntegrationTestCase', 'MediaWikiTestCase' ); diff --git a/tests/phpunit/MediaWikiUnitTestCase.php b/tests/phpunit/MediaWikiUnitTestCase.php index 407be208b6de..06f0c9cd01aa 100644 --- a/tests/phpunit/MediaWikiUnitTestCase.php +++ b/tests/phpunit/MediaWikiUnitTestCase.php @@ -1,7 +1,5 @@ <?php /** - * Base class for MediaWiki unit tests. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -23,6 +21,12 @@ use PHPUnit\Framework\TestCase; +/** + * Base class for unit tests. + * + * Extend this class if you are testing classes which use dependency injection and do not access + * global functions, variables, services or a storage backend. + */ abstract class MediaWikiUnitTestCase extends TestCase { use PHPUnit4And6Compat; use MediaWikiCoversValidator; diff --git a/tests/phpunit/bootstrap.maintenance.php b/tests/phpunit/bootstrap.maintenance.php new file mode 100644 index 000000000000..6c9440c93e39 --- /dev/null +++ b/tests/phpunit/bootstrap.maintenance.php @@ -0,0 +1,34 @@ +<?php +/** + * Bootstrapping for MediaWiki PHPUnit tests when called via the maintenance class tests runner. + * This file is included by phpunit and is NOT in the global scope. + * + * @file + */ + +if ( !defined( 'MW_PHPUNIT_TEST' ) ) { + echo <<<EOF +You are running these tests directly from phpunit. You may not have all globals correctly set. +Running phpunit.php instead is recommended. +EOF; + require_once __DIR__ . "/phpunit.php"; +} + +// The PHPUnit_TextUI_TestRunner class will run each test suite and may call +// exit() with an exit status code. As such, we cannot run code "after the last test" +// by adding statements to PHPUnitMaintClass::execute or MediaWikiPHPUnitCommand::run. +// Instead, we work around it by registering a shutdown callback from the bootstrap +// file, which runs before PHPUnit starts. +// @todo Once we use PHPUnit 8 or higher, use the 'AfterLastTestHook' feature. +// https://phpunit.readthedocs.io/en/8.0/extending-phpunit.html#available-hook-interfaces +register_shutdown_function( function () { + // This will: + // - clear the temporary job queue. + // - allow extensions to delete any temporary tables they created. + // - restore ability to connect to the real database, + // (for logging profiling data). + MediaWikiTestCase::teardownTestDB(); + + // Log profiling data, e.g. in the database or UDP + wfLogProfilingData(); +} ); diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 79cb5be33809..258c82255308 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -1,34 +1,67 @@ <?php + /** - * Bootstrapping for MediaWiki PHPUnit tests - * This file is included by phpunit and is NOT in the global scope. + * PHPUnit bootstrap file. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html * * @file + * @ingroup Testing + */ + +if ( PHP_SAPI !== 'cli' ) { + die( 'This file is only meant to be executed indirectly by PHPUnit\'s bootstrap process!' ); +} + +/** + * PHPUnit includes the bootstrap file inside a method body, while most MediaWiki startup files + * assume to be included in the global scope. + * This utility provides a way to include these files: it makes all globals available in the + * inclusion scope before including the file, then exports all new or changed globals. + * + * @param string $fileName the file to include */ +function wfRequireOnceInGlobalScope( $fileName ) { + // phpcs:disable MediaWiki.Usage.ForbiddenFunctions.extract + extract( $GLOBALS, EXTR_REFS | EXTR_SKIP ); + // phpcs:enable -if ( !defined( 'MW_PHPUNIT_TEST' ) ) { - echo <<<EOF -You are running these tests directly from phpunit. You may not have all globals correctly set. -Running phpunit.php instead is recommended. -EOF; - require_once __DIR__ . "/phpunit.php"; + require_once $fileName; + + foreach ( get_defined_vars() as $varName => $value ) { + $GLOBALS[$varName] = $value; + } } -// The PHPUnit_TextUI_TestRunner class will run each test suite and may call -// exit() with an exit status code. As such, we cannot run code "after the last test" -// by adding statements to PHPUnitMaintClass::execute or MediaWikiPHPUnitCommand::run. -// Instead, we work around it by registering a shutdown callback from the bootstrap -// file, which runs before PHPUnit starts. -// @todo Once we use PHPUnit 8 or higher, use the 'AfterLastTestHook' feature. -// https://phpunit.readthedocs.io/en/8.0/extending-phpunit.html#available-hook-interfaces -register_shutdown_function( function () { - // This will: - // - clear the temporary job queue. - // - allow extensions to delete any temporary tables they created. - // - restore ability to connect to the real database, - // (for logging profiling data). - MediaWikiTestCase::teardownTestDB(); - - // Log profiling data, e.g. in the database or UDP - wfLogProfilingData(); -} ); +define( 'MEDIAWIKI', true ); +define( 'MW_PHPUNIT_TEST', true ); + +// We don't use a settings file here but some code still assumes that one exists +define( 'MW_CONFIG_FILE', 'LocalSettings.php' ); + +$IP = realpath( __DIR__ . '/../../' ); + +// these variables must be defined before setup runs +$GLOBALS['IP'] = $IP; +// Faking for Setup.php +$GLOBALS['wgScopeTest'] = 'MediaWiki Setup.php scope test'; +$GLOBALS['wgCommandLineMode'] = true; +$GLOBALS['wgAutoloadClasses'] = []; + +require_once "$IP/tests/common/TestSetup.php"; + +wfRequireOnceInGlobalScope( "$IP/includes/AutoLoader.php" ); +wfRequireOnceInGlobalScope( "$IP/tests/common/TestsAutoLoader.php" ); diff --git a/tests/phpunit/includes/db/DatabaseSqliteTest.php b/tests/phpunit/integration/includes/db/DatabaseSqliteTest.php index 0f5c1f2f7f4c..6fa911b67e16 100644 --- a/tests/phpunit/includes/db/DatabaseSqliteTest.php +++ b/tests/phpunit/integration/includes/db/DatabaseSqliteTest.php @@ -13,7 +13,7 @@ use Wikimedia\TestingAccessWrapper; * @group Database * @group medium */ -class DatabaseSqliteTest extends MediaWikiTestCase { +class DatabaseSqliteTest extends \MediaWikiIntegrationTestCase { /** @var DatabaseSqlite */ protected $db; diff --git a/tests/phpunit/suite.xml b/tests/phpunit/suite.xml index cc6ac31f70c6..d7d3c6130b3e 100644 --- a/tests/phpunit/suite.xml +++ b/tests/phpunit/suite.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<phpunit bootstrap="./bootstrap.php" +<phpunit bootstrap="./bootstrap.maintenance.php" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" diff --git a/tests/phpunit/unit-tests.xml b/tests/phpunit/unit-tests.xml deleted file mode 100644 index cd4118ca0d9b..000000000000 --- a/tests/phpunit/unit-tests.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<phpunit bootstrap="unit/initUnitTests.php" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" - - colors="true" - backupGlobals="false" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - forceCoversAnnotation="true" - stopOnFailure="false" - timeoutForSmallTests="10" - timeoutForMediumTests="30" - timeoutForLargeTests="60" - beStrictAboutTestsThatDoNotTestAnything="true" - beStrictAboutOutputDuringTests="true" - beStrictAboutTestSize="true" - verbose="false"> - <testsuites> - <testsuite name="tests"> - <directory>unit</directory> - </testsuite> - </testsuites> - <groups> - <exclude> - <group>Broken</group> - </exclude> - </groups> - <filter> - <whitelist addUncoveredFilesFromWhitelist="true"> - <directory suffix=".php">../../includes</directory> - <directory suffix=".php">../../languages</directory> - <directory suffix=".php">../../maintenance</directory> - <exclude> - <directory suffix=".php">../../languages/messages</directory> - <file>../../languages/data/normalize-ar.php</file> - <file>../../languages/data/normalize-ml.php</file> - </exclude> - </whitelist> - </filter> -</phpunit> diff --git a/tests/phpunit/unit/initUnitTests.php b/tests/phpunit/unit/initUnitTests.php deleted file mode 100644 index 212187711a5e..000000000000 --- a/tests/phpunit/unit/initUnitTests.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * PHPUnit bootstrap file for the unit test suite. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Testing - */ - -if ( PHP_SAPI !== 'cli' ) { - die( 'This file is only meant to be executed indirectly by PHPUnit\'s bootstrap process!' ); -} - -/** - * PHPUnit includes the bootstrap file inside a method body, while most MediaWiki startup files - * assume to be included in the global scope. - * This utility provides a way to include these files: it makes all globals available in the - * inclusion scope before including the file, then exports all new or changed globals. - * - * @param string $fileName the file to include - */ -function wfRequireOnceInGlobalScope( $fileName ) { - // phpcs:disable MediaWiki.Usage.ForbiddenFunctions.extract - extract( $GLOBALS, EXTR_REFS | EXTR_SKIP ); - // phpcs:enable - - require_once $fileName; - - foreach ( get_defined_vars() as $varName => $value ) { - $GLOBALS[$varName] = $value; - } -} - -define( 'MEDIAWIKI', true ); -define( 'MW_PHPUNIT_TEST', true ); - -// We don't use a settings file here but some code still assumes that one exists -define( 'MW_CONFIG_FILE', 'LocalSettings.php' ); - -$IP = realpath( __DIR__ . '/../../..' ); - -// these variables must be defined before setup runs -$GLOBALS['IP'] = $IP; -$GLOBALS['wgCommandLineMode'] = true; - -require_once "$IP/tests/common/TestSetup.php"; - -wfRequireOnceInGlobalScope( "$IP/includes/AutoLoader.php" ); -wfRequireOnceInGlobalScope( "$IP/includes/Defines.php" ); -wfRequireOnceInGlobalScope( "$IP/includes/DefaultSettings.php" ); -wfRequireOnceInGlobalScope( "$IP/includes/GlobalFunctions.php" ); - -require_once "$IP/tests/common/TestsAutoLoader.php"; - -TestSetup::applyInitialConfig(); |