11 define(
'MW_PHPUNIT_TEST',
true );
16 require_once dirname( dirname( __DIR__ ) ) .
"/maintenance/Maintenance.php";
23 'use-filebackend' =>
false,
24 'use-bagostuff' =>
false,
25 'use-jobqueue' =>
false,
26 'keep-uploads' =>
false,
27 'use-normal-tables' =>
false,
33 parent::__construct();
36 'Class name of the PHPUnit entry point to use',
42 'Log testing activity to the PHPUnitCommand log channel.',
48 'Only run parser tests that match the given regex.',
52 $this->
addOption(
'file',
'File describing parser tests.',
false,
true );
53 $this->
addOption(
'use-filebackend',
'Use filebackend',
false,
true );
54 $this->
addOption(
'use-bagostuff',
'Use bagostuff',
false,
true );
55 $this->
addOption(
'use-jobqueue',
'Use jobqueue',
false,
true );
58 'Re-use the same upload directory for each test, don\'t delete it.',
62 $this->
addOption(
'use-normal-tables',
'Use normal DB tables.',
false,
false );
64 'reuse-db',
'Init DB only if tables are missing and keep after finish.',
77 global $wgDevelopmentWarnings;
78 global $wgSessionProviders;
80 global $wgAuthManagerConfig, $wgAuth;
83 require_once __DIR__ .
'/../TestsAutoLoader.php';
86 $wgDevelopmentWarnings =
true;
100 $wgLanguageConverterCacheType =
'hash';
102 $wgMainStash =
'hash';
105 'default' => [
'class' =>
'JobQueueMemory',
'order' =>
'fifo' ],
108 $wgUseDatabaseMessages =
false; # Set
for future resets
111 $wgLocaltimezone =
'UTC';
113 $wgLocalisationCacheConf[
'storeClass'] =
'LCStoreNull';
118 $wgSessionProviders = [
123 'callUserSetCookiesHook' =>
true,
129 $wgAuthManagerConfig = [
135 'authoritative' =>
false,
141 'authoritative' =>
true,
145 'secondaryauth' => [],
152 'AlternateUserMailer',
158 ini_set(
'xdebug.max_nesting_level', 1000 );
163 ini_set(
'serialize_precision', 17 );
173 restore_error_handler();
177 # Make sure we have --configuration or PHPUnit might complain
178 if ( !in_array(
'--configuration', $_SERVER[
'argv'] ) ) {
180 array_splice( $_SERVER[
'argv'], 1, 0,
181 [
'--configuration', $IP .
'/tests/phpunit/suite.xml' ] );
184 if ( $this->
hasOption(
'with-phpunitclass' ) ) {
186 $wgPhpUnitClass = $this->
getOption(
'with-phpunitclass' );
188 # Cleanup $args array so the option and its value do not
190 $key = array_search(
'--with-phpunitclass', $_SERVER[
'argv'] );
191 unset( $_SERVER[
'argv'][
$key] );
192 unset( $_SERVER[
'argv'][$key + 1] );
193 $_SERVER[
'argv'] = array_values( $_SERVER[
'argv'] );
196 $key = array_search(
'--debug-tests', $_SERVER[
'argv'] );
197 if (
$key !==
false && array_search(
'--printer', $_SERVER[
'argv'] ) ===
false ) {
198 unset( $_SERVER[
'argv'][
$key] );
199 array_splice( $_SERVER[
'argv'], 1, 0,
'MediaWikiPHPUnitTestListener' );
200 array_splice( $_SERVER[
'argv'], 1, 0,
'--printer' );
203 foreach ( self::$additionalOptions
as $option => $default ) {
204 $key = array_search(
'--' . $option, $_SERVER[
'argv'] );
205 if (
$key !==
false ) {
206 unset( $_SERVER[
'argv'][
$key] );
207 if ( $this->mParams[$option][
'withArg'] ) {
208 self::$additionalOptions[$option] = $_SERVER[
'argv'][$key + 1];
209 unset( $_SERVER[
'argv'][$key + 1] );
211 self::$additionalOptions[$option] =
true;
228 foreach ( $_SERVER[
'argv']
as $key => $arg ) {
231 } elseif ( strstr( $arg,
'=' ) ) {
232 foreach ( explode(
'=', $arg, 2 )
as $argPart ) {
239 $_SERVER[
'argv'] = $argv;
247 if ( !class_exists(
'PHPUnit_Framework_TestCase' ) ) {
248 echo
"PHPUnit not found. Please install it and other dev dependencies by
249 running `composer install` in MediaWiki root directory.\n";
253 echo
"PHPUnit entry point '" .
$wgPhpUnitClass .
"' not found. Please make sure you installed
254 the containing component and check the spelling of the class name.\n";
258 echo defined(
'HHVM_VERSION' ) ?
259 'Using HHVM ' . HHVM_VERSION .
' (' . PHP_VERSION .
")\n" :
260 'Using PHP ' . PHP_VERSION .
"\n";
static $additionalOptions
$wgMainStash
Main object stash type.
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
hasOption($name)
Checks to see if a particular param exists.
$wgMainWANCache
Main Wide-Area-Network cache type.
require_once RUN_MAINTENANCE_IF_MAIN
when a variable name is used in a it is silently declared as a new local masking the global
forceFormatServerArgv()
Force the format of elements in $_SERVER['argv'].
addOption($name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
static register($name, $callback)
Attach an event handler to a given hook.
$wgParserCacheType
The cache type for storing article HTML.
static clear($name)
Clears hooks registered via Hooks::register().
$wgLocalisationCacheConf
Localisation cache configuration.
$wgMessageCacheType
The cache type for storing the contents of the MediaWiki namespace.
$wgUseDatabaseMessages
Translation using MediaWiki: namespace.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the future
CACHE_MEMCACHED $wgMainCacheType
$wgLanguageConverterCacheType
The cache type for storing language conversion tables, which are used when parsing certain text and i...
$wgLocaltimezone
Fake out the timezone that the server thinks it's in.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getOption($name, $default=null)
Get an option, or return the default.
$wgSessionCacheType
The cache type for storing session data.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when needed(most notably, OutputPage::addWikiText()).The StandardSkin object is a complete implementation