MediaWiki REL1_31
UploadFromUrlTestSuite.php
Go to the documentation of this file.
1<?php
2
3require_once dirname( __DIR__ ) . '/includes/upload/UploadFromUrlTest.php';
4
5class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite {
6 public $savedGlobals = [];
7
8 public static function addTables( &$tables ) {
9 $tables[] = 'user_properties';
10 $tables[] = 'filearchive';
11 $tables[] = 'logging';
12 $tables[] = 'updatelog';
13 $tables[] = 'iwlinks';
14
15 return true;
16 }
17
18 protected function setUp() {
22
23 $tmpDir = $this->getNewTempDirectory();
24 $tmpGlobals = [];
25
26 $tmpGlobals['wgScript'] = '/index.php';
27 $tmpGlobals['wgScriptPath'] = '/';
28 $tmpGlobals['wgArticlePath'] = '/wiki/$1';
29 $tmpGlobals['wgStylePath'] = '/skins';
30 $tmpGlobals['wgThumbnailScriptPath'] = false;
31 $tmpGlobals['wgLocalFileRepo'] = [
32 'class' => LocalRepo::class,
33 'name' => 'local',
34 'url' => 'http://example.com/images',
35 'hashLevels' => 2,
36 'transformVia404' => false,
37 'backend' => new FSFileBackend( [
38 'name' => 'local-backend',
39 'wikiId' => wfWikiID(),
40 'containerPaths' => [
41 'local-public' => "{$tmpDir}/test-repo/public",
42 'local-thumb' => "{$tmpDir}/test-repo/thumb",
43 'local-temp' => "{$tmpDir}/test-repo/temp",
44 'local-deleted' => "{$tmpDir}/test-repo/delete",
45 ]
46 ] ),
47 ];
48 foreach ( $tmpGlobals as $var => $val ) {
49 if ( array_key_exists( $var, $GLOBALS ) ) {
50 $this->savedGlobals[$var] = $GLOBALS[$var];
51 }
52 $GLOBALS[$var] = $val;
53 }
54
55 $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
57 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
58
60 DeferredUpdates::clearPendingUpdates();
63
66 $wgUser = new User;
67 $wgLang = $context->getLanguage();
68 $wgOut = $context->getOutput();
69 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], [ $wgParserConf ] );
70 $wgRequest = $context->getRequest();
71
72 if ( $wgStyleDirectory === false ) {
73 $wgStyleDirectory = "$IP/skins";
74 }
75
78 }
79
80 protected function tearDown() {
81 foreach ( $this->savedGlobals as $var => $val ) {
82 $GLOBALS[$var] = $val;
83 }
84 // Restore backends
87
88 parent::tearDown();
89 }
90
91 public static function suite() {
92 // Hack to invoke the autoloader required to get phpunit to recognize
93 // the UploadFromUrlTest class
94 class_exists( 'UploadFromUrlTest' );
95 $suite = new UploadFromUrlTestSuite( 'UploadFromUrlTest' );
96
97 return $suite;
98 }
99}
$GLOBALS['IP']
$wgParserCacheType
The cache type for storing article HTML.
$wgStyleDirectory
Filesystem stylesheets directory.
$wgNamespaceProtection
Set the minimum permissions required to edit pages in each namespace.
$wgParserConf
Parser configuration.
$wgNamespaceAliases
Namespace aliases.
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
wfGetMainCache()
Get the main cache object.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
$wgUser
Definition Setup.php:902
$wgOut
Definition Setup.php:912
$wgParser
Definition Setup.php:917
if(! $wgDBerrorLogTZ) $wgRequest
Definition Setup.php:737
Class for a file system (FS) based file backend.
static destroySingleton()
Destroy the singleton instance.
static destroySingleton()
Destroy the singleton instance, so that a new one will be created next time singleton() is called.
Definition RepoGroup.php:73
static resetMain()
Resets singleton returned by getMain().
static getMain()
Get the RequestContext object associated with the main request.
Class to implement stub globals, which are globals that delay loading the their associated module cod...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:53
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 and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
Definition design.txt:56
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
Definition hooks.txt:1015
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2811
$IP
Definition update.php:3
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $messageMemc
Definition globals.txt:66
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
Definition globals.txt:66
const NS_FILE
Definition Defines.php:80
const CACHE_NONE
Definition Defines.php:112
const NS_MEDIAWIKI
Definition Defines.php:82
const NS_FILE_TALK
Definition Defines.php:81