wiki.techinc.nl/tests/phpunit/includes/media
Timo Tijhof 29e0183a56 phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase
This code didn't work because the $GLOBALS array is exposed by reference.
Once this reference was broken by unset(), the rest just manipulated a
local array that happens to be called "GLOBALS". It must not be unset or
re-assigned. It can only be changed in-place.

Before this, the execution of a MediaWikiUnitTestCase test stored a
copy of GLOBALS in unitGlobals, then lost the GLOBALS pointer and
created a new variable called "GLOBALS". As such, the tearDown() function
didn't do what it meant to do, either – which then results in odd
failures like T230023

Rewrite it as follows:

* In setup, store the current GLOBALS keys and values, then reduce
  GLOBALS to only the whitelisted keys and values.

* In teardown, restore the original state.

* As optimisation, do this from setUpBeforeClass as well, so that
  there are relatively few globals to reset between tests.
  (Thanks @Simetrical!)

The following tests were previously passing by accident under
MediaWikiUnitTestCase but actually did depend on global config.

* MainSlotRoleHandlerTest (…, ContentHandler, $wgContentHandlers)
* SlotRecordTest (…, ContentHandler, $wgContentHandlers)
* WikiReferenceTest (wfParseUrl, $wgUrlProtocols)
* DifferenceEngineSlotDiffRendererTest (DifferenceEngine, wfDebug, …)
* SlotDiffRendererTest (…, ContentHandler, $wgContentHandlers)
* FileBackendDBRepoWrapperTest (wfWikiID, "Backend domain ID not provided")
* JpegMetadataExtractorTest (…, wfDebug, …, LoggerFactory, …)
* ParserFactoryTest (…, wfDebug, …, LoggerFactory, InvalidArgumentException)
* MediaWikiPageNameNormalizerTest (…, wfDebug, …, LoggerFactory, …)
* SiteExporterTest (SiteImporter, wfLogWarning, …)
* SiteImporterTest (Site::newForType, $wgSiteTypes)
* ZipDirectoryReaderTest (…, wfDebug, …, LoggerFactory, …)

Bug: T230023
Change-Id: Ic22075bb5e81b7c2c4c1b8647547aa55306a10a7
2019-09-02 20:58:34 +01:00
..
BitmapMetadataHandlerTest.php Fix excessive whitespace in BitmapMetadataHandlerTest.php 2019-06-21 09:26:36 +01:00
BitmapScalingTest.php Use ::class to resolve class names in tests 2018-01-26 22:49:13 +01:00
DjVuTest.php Fix assertArrayEquals() calls with bogus 3rd parameter 2019-03-14 18:02:08 +01:00
ExifBitmapTest.php build: Updating mediawiki/mediawiki-codesniffer to 15.0.0 2018-01-01 14:10:16 +01:00
ExifRotationTest.php Add an explicit check for correct operation to ExifRotationTest 2018-08-01 18:26:41 -07:00
ExifTest.php Use file width/height instead of metadata for getContentHeaders 2017-05-23 19:18:58 +00:00
FakeDimensionFile.php Move phpunit @group from file comment to class comment 2018-03-10 11:48:28 +01:00
FormatMetadataTest.php build: Updating mediawiki/mediawiki-codesniffer to 22.0.0 2018-09-16 15:51:11 +00:00
GIFHandlerTest.php Rename tests/phpunit/includes/media files to match class names 2019-01-29 23:21:13 -08:00
JpegMetadataExtractorTest.php phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase 2019-09-02 20:58:34 +01:00
JpegPixelFormatTest.php JpegPixelFormatTest: use Shell class 2019-02-09 22:20:25 -08:00
JpegTest.php build: Updating mediawiki/mediawiki-codesniffer to 15.0.0 2018-01-01 14:10:16 +01:00
MediaWikiMediaTestCase.php Remove broken explode() from MediaWikiMediaTestCase::dataFile() 2019-03-28 23:01:27 +00:00
PNGHandlerTest.php Rename tests/phpunit/includes/media files to match class names 2019-01-29 23:21:13 -08:00
PNGMetadataExtractorTest.php Remove very, very old disabled test cases and todos 2017-12-28 18:44:31 +00:00
SvgHandlerTest.php Fix @param tags 2019-02-03 16:49:10 +01:00
SVGReaderTest.php Deprecate wrapper SVGMetadataExtractor::getMetadata 2019-07-26 12:07:54 -07:00
TiffTest.php build: Updating mediawiki/mediawiki-codesniffer to 15.0.0 2018-01-01 14:10:16 +01:00
WebPHandlerTest.php Revert "Separate MediaWiki unit and integration tests" 2019-06-13 23:00:08 +00:00
XCFHandlerTest.php Rename tests/phpunit/includes/media files to match class names 2019-01-29 23:21:13 -08:00