aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/diff/DifferenceEngineSlotDiffRendererTest.php
Commit message (Collapse)AuthorAgeFilesLines
* phpunit: Mass-replace setMethods with onlyMethods and adjustDaimona Eaytoy2021-04-161-1/+1
| | | | | | | | | | | | Ended up using grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g' special-casing setMethods( null ) -> onlyMethods( [] ) and then manual fix of failing test (from PS2 onwards). Bug: T278010 Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
* Drop strings for wgExternalDiffEngine, deprecated in 1.27 and 1.32James D. Forrester2019-10-031-8/+0
| | | | | | | Also move the 'unit' test into integration, given it tests code using globals. Change-Id: Ie039cae9b5d2870c18a6deefec9a73de522dd847
* phpunit: Repair GLOBALS reset in MediaWikiUnitTestCaseTimo Tijhof2019-09-021-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Load GlobalFunctions.php to tests/phpunit/bootstrap.phpAmir Sarabadani2019-07-141-44/+0
| | | | | | | That mostly enables testing global functions Bug: T87781 Change-Id: Ib42c56a67926ebcdba53f4c6c54a5bff98cb77a3
* Revert "Separate MediaWiki unit and integration tests"Legoktm2019-06-131-0/+44
| | | | | | | | This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9. Reason for revert: Broke postgres tests. Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
* Separate MediaWiki unit and integration testsMáté Szabó2019-06-131-44/+0
| | | | | | | | | | | | | | | | | | | | | This changeset implements T89432 and related tickets and is based on exploration done at the Prague Hackathon. The goal is to identify tests in MediaWiki core that can be run without having to install & configure MediaWiki and its dependencies, and provide a way to execute these tests via the standard phpunit entry point, allowing for faster development and integration with existing tooling like IDEs. The initial set of tests that met these criteria were identified using the work Amir did in I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory under phpunit/ and organized into a separate test suite. The environment for this suite is set up via a PHPUnit bootstrap file without a custom entry point. You can execute these tests by running: $ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml Bug: T89432 Bug: T87781 Bug: T84948 Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
* [MCR] Render multi-slot diffsGergő Tisza2018-08-201-0/+44
Move logic for rendering a diff between two content objects out of DifferenceEngine, into a new SlotDiffRenderer class. Make DifferenceEngine use multiple SlotDiffRenderers, one per slot. This separates the class tree for changing high-level diff properties such as the header or the revision selection method (same as before: subclass DifferenceEngine and override ContentHandler::getDiffEngineClass or implement GetDifferenceEngine) and the one for changing the actual diff rendering for a given content type (subclass SlotDiffRenderer and override ContentHandler::getSlotDiffRenderer or implement GetSlotDiffRenderer). To keep B/C, when SlotDiffRenderer is not overridden for a given content type but DifferenceEngine is, that DifferenceEngine will be used instead. The weak point of the scheme is overriding the DifferenceEngine methods passing control to the SlotDiffRenderers (the ones calling getDifferenceEngines), without calling the parent. These are: showDiffStyle, getDiffBody, getDiffBodyCacheKeyParams. Extensions doing that will probably break in unpredictable ways (most likely, only showing the main slot diff). Nothing in gerrit does it, at least. A new GetSlotDiffRenderer hook is added to modify rendering for content models not owned by the extension, much like how GetDifferenceEngine works. Also deprecates public access to mNewRev/mOldRev and creates public getters instead. DifferenceEngine never supported external changes to those properties, this just acknowledges it. Bug: T194731 Change-Id: I2f8a9dbebd2290b7feafb20e2bb2a2693e18ba11 Depends-On: I04e885a33bfce5bccc807b9bcfe1eaa577a9fd47 Depends-On: I203d8895bf436b7fee53fe4718dede8a3b1768bc