Page MenuHomePhabricator
Paste P5315

Extension TestGlobals
ActivePublic

Authored by Seb35 on Apr 23 2017, 11:12 AM.
Tags
None
Referenced Files
F7721954: Extension TestGlobals
Apr 23 2017, 11:12 AM
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 );
}
}