Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P5315
Extension TestGlobals
Active
Public
Actions
Authored by
Seb35
on Apr 23 2017, 11:12 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F7721954: Extension TestGlobals
Apr 23 2017, 11:12 AM
2017-04-23 11:12:26 (UTC+0)
Subscribers
None
/mediawiki/extensions/TestGlobals/extension.json:
{
"name": "TestGlobals",
"manifest_version": 1
}
/mediawiki/extensions/TestGlobals/tests/phpunit/TestGlobalsTest.php:
<?php
/**
* Class TestGlobalsTest.
*
* @author Sébastien Beyou ~ Seb35 <seb35@seb35.fr>
* @license GPL-3.0+ GNU General Public License v3.0, or (at your option) any later version.
*/
/**
* Test globals conservation.
*/
class
TestGlobalsTest
extends
MediaWikiTestCase
{
/**
* Construct the test case.
*
* @param string|null $name Name of the test case.
* @param array $data
* @param string $dataName
* @return TestGloblasTest
*/
public
function
__construct
(
$name
=
null
,
array
$data
=
array
(),
$dataName
=
''
)
{
parent
::
__construct
(
$name
,
$data
,
$dataName
);
# MediaWikiTestCase disables the @backupGlobals in its constructor.
# Although it speeds up greatly the tests, there is no more checks on global variables.
# This restores the defaut value (case-by-case choice). When a lot of globals are changed,
# PHPUnit can take a LOT of time to compute differences (10+ min)
$this
->
backupGlobals
=
null
;
# Closures are thought to be serialisable although they are not, so blacklist them
$this
->
backupGlobalsBlacklist
=
array_merge
(
$this
->
backupGlobalsBlacklist
,
array
(
'factory'
,
'wgExtensionFunctions'
,
'wgHooks'
,
'wgParamDefinitions'
,
'wgParser'
,
'wgFlowActions'
,
)
);
}
/**
* Test if global variables are correctly conserved.
*
* @backupGlobals enabled
* @coversNothing
*/
function
testGlobals
()
{
$this
->
assertTrue
(
true
);
}
}
Event Timeline
Seb35
created this paste.
Apr 23 2017, 11:12 AM
2017-04-23 11:12:26 (UTC+0)
Seb35
mentioned this in
T163640: ConfiguredReadOnlyMode has a bad config during testing
.
Apr 23 2017, 11:24 AM
2017-04-23 11:24:12 (UTC+0)
Log In to Comment