aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/diff/DifferenceEngineTest.php
Commit message (Collapse)AuthorAgeFilesLines
* diff: Fix small issues and compact syntax in DifferenceEngineThiemo Kreuz2022-02-041-0/+1
| | | | | | | | | | | | The purpose of all these changes is not only to make the code shorter, but to make it more readable. Notable: * Fix wrong type hints. * The `foreach ( $roles )` loop was processing everything twice. * Inline preg_replace_callback() callbacks. Change-Id: I2b8146946ab6966cc6f047556a0a898624af181a
* Remove or replace usages of "sanity"Reedy2021-11-211-2/+2
| | | | | | | Still some more to go... Bug: T254646 Change-Id: Ia117f01e443c35b4765f3275cab4f2707e1be96f
* build: Updating dependencieslibraryupgrader2021-07-221-1/+1
| | | | | | | | | | | | | | composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 The following sniffs now pass and were enabled: * Generic.ControlStructures.InlineControlStructure * MediaWiki.PHPUnit.AssertCount.NotUsed npm: * svgo: 2.3.0 → 2.3.1 * https://npmjs.com/advisories/1754 (CVE-2021-33587) Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
* Use WikiPage::doUserEditContent() instead of ::doEditContent()DannyS7122021-06-281-1/+2
| | | | | | | | Results in passing a user where previously the fallback to $wgUser was being used, mostly in tests. Bug: T255507 Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
* Replace RecentChange::getPerformer with RecentChange::getPerformerIdentityRoman Stolar2021-05-271-0/+50
| | | | | | | Preparing replace in core (DifferenceEngine.php, Article.php, ChangesListSpecialPage.php) Bug: T276412 Change-Id: I4fd9cbd9404879d082179b68a9993e7203e43a8d
* Remove meaningless ->expects( $this->any() ) from all testsThiemo Kreuz2021-04-231-4/+2
| | | | | | | | | | | | | | | It is not entirely meaningless. It might be an indicator that the number of calls to a method is intentionally unlimited. This is similar to e.g. an @inheritDoc PHPDoc comment that marks a method as being "intentionally undocumented". However, what's the meaning of being "intentionally unconstrained"? Let's just not have any constraint then. I feel all these ->expects( $this->any() ) bloat the test code so much that it's never worth it. Change-Id: I9925e7706bd03e1666f6eb0b284cb42b0dd3be23
* phpunit: Mass-replace setMethods with onlyMethods and adjustDaimona Eaytoy2021-04-161-2/+2
| | | | | | | | | | | | 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
* Add support for derived MCR slotsCindy Cicalese2021-03-181-0/+20
| | | | | Bug: T277203 Change-Id: I1c70abc00c912b283e3e6eb2266633ae3f57673b
* Deprecate constructing revision with non-proper pagePetr Pchelko2021-03-101-19/+2
| | | | | Bug: T275531 Change-Id: If641a5a901210ba1a1ea6a41fa6a18c08f4183db
* Fix incomplete/bogus PHPDoc tags in various testsThiemo Kreuz2021-01-141-2/+2
| | | | | | | | | | | Most of these are found by the not yet released I10559d8. I remove the type MockObject in some cases when the calling code really does not need to know if he get's a mock or the real thing. However, I do this only in places that are very closely related to the fixes. Change-Id: I26a4c3c5a8ae141bf56161b52b54bce7e68f2e30
* Create diff markers with CSSEd Sanders2020-12-301-0/+4
| | | | | | | Also put <br>s into empty lines so linebreaks are preserved when copying. Bug: T192526 Change-Id: I926bedf71562c74a0aa33fbeb11f8d1a4e4130c7
* Make use of array deconstruction directly in foreach, if possibleThiemo Kreuz2020-11-121-6/+2
| | | | | | | | | | | Deconstructing non-sparse, numerically indexed arrays directly in foreach (a.k.a. using the list() syntax in foreach) is possible since PHP 5.5. The possibility to use string array keys as well as non-sequential numeric keys in array deconstruction was added in PHP 7.1. Change-Id: I56a48552a45f61cedc291b306cad8548fc70d485
* MediaWikiTestCase to MediaWikiIntegrationTestCaseaddshore2020-06-301-1/+1
| | | | | | | | | | | | | The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
* Use nullable type in function signatureUmherirrender2019-11-201-1/+1
| | | | | | Enable the sniff Change-Id: I9fff860706b0ffb99bb9e78ff26d15bc7c87bdb4
* Add $wgDiffEngineBrad Jorsch2019-11-051-0/+2
| | | | | | | | The immediate use case is for testing, where some tests need to use the PHP implementation even when wikidiff2 is installed. Bug: T237049 Change-Id: I41dc4c0933429065d7638f518ec31f0a056afc41
* tests: Add explicit return type void to setUp() and tearDown()Max Semenik2019-10-301-1/+1
| | | | | | Bug: T192167 Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43 Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
* Kill the remaining usages of PHPUnit4And6Compat methodsDaimona Eaytoy2019-10-061-1/+2
| | | | | Bug: T192167 Change-Id: I1ea19e9b53683b7d32ff9836990ee73ab3e11104
* Merge "Replace setExpectedException with two args"jenkins-bot2019-10-051-2/+4
|\
| * Replace setExpectedException with two argsDaimona Eaytoy2019-10-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | Find: ^(\t*)(\$this->)setExpectedException\(\s+(\\?[a-z\\]+::class),\s+('(?:[^'\\]|\\')+'|"(?:[^"\\]|\\")+")\s+\); Replace: $1$2expectException( $3 );\n$1\$this->expectExceptionMessage( $4 ); +broke long lines manually. Bug: T192167 Change-Id: I5557b4372625def55a53ac637c2f980f51f12933
* | Drop strings for wgExternalDiffEngine, deprecated in 1.27 and 1.32James D. Forrester2019-10-031-24/+0
|/ | | | | | | Also move the 'unit' test into integration, given it tests code using globals. Change-Id: Ie039cae9b5d2870c18a6deefec9a73de522dd847
* Call resetServices() when setting globals in testsAryeh Gregor2019-08-291-7/+10
| | | | | | | | | | | Now that resetServices() will preserve (but reset) customized services, it should be reasonably safe to call it every time globals are changed, and much more effective than relying on tests to call it every time themselves. Depends-On: Iab8ea3a61bbc6803805d855ef23c071067646f71 Depends-On: I00e35ecea6a27468674b2a6e7d9d9eb6518e3bd5 Change-Id: Ie7a89f6ed7d52a0bc01672019ff92e7ee105a1f3
* Fix order of @var parameter in PHPFomafix2019-04-081-2/+2
| | | | | | | | | | | | Replace @var $foo type by @var type $foo Change-Id: Iec8b90ffea4028a1005daef422b7c4ec38c2715f
* Re-namespace RevisionStore and RevisionRecord classesBrad Jorsch2018-10-091-3/+3
| | | | | | | | | | | | | | | | | | | During development a lot of classes were placed in MediaWiki\Storage\. The precedent set would mean that every class relating to something stored in a database table, plus all related value classes and such, would go into that namespace. Let's put them into MediaWiki\Revision\ instead. Then future classes related to the 'page' table can go into MediaWiki\Page\, future classes related to the 'user' table can go into MediaWiki\User\, and so on. Note I didn't move DerivedPageDataUpdater, PageUpdateException, PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\ instead. Bug: T204158 Change-Id: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
* Add constant for the name of the 'main' slot for MCRGergő Tisza2018-09-241-4/+4
| | | | | Bug: T202142 Change-Id: I97a74e5a029b014f3c2195188936d5c8233c1b7f
* Avoid constructing Title objects in data providersdaniel2018-09-031-1/+19
| | | | | Bug: T202641 Change-Id: I34efa0b9329e740bcb292b2529ec8f7f925dc346
* Fix DifferenceEngine revision loading logicGergő Tisza2018-08-241-9/+14
| | | | | | Bug: T201218 Bug: T202454 Change-Id: I867900190cb45b983e89769c7fc0f965e2651918
* [MCR] Render multi-slot diffsGergő Tisza2018-08-201-0/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add tests for DiffEngine tooltipsWMDE-Fisch2017-11-221-0/+28
| | | | Change-Id: I8e6560efc35a6bd875f96edb9b59c9961b81a956
* Convert all array() syntax to []Kunal Mehta2016-02-171-13/+13
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* tests: Clean up file headersTimo Tijhof2015-04-011-1/+0
| | | | | | | | | | * Remove redundant @licence/@license from test suite files. They already have full licence headers. And @licence raises a warning in Doxygen. * Fix weird messes of comments inside comments and other things. Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
* Change @return to start with typeumherirrender2014-08-201-1/+1
| | | | | | | | | | | MediaWiki default is "@return type Description", so set a type after return and start the description with a capital letter. Also use the more common spelling of boolean. See http://phpdoc.org/docs/latest/references/phpdoc/tags/return.html for more about @return Change-Id: I4e5198822fe92836f9cef9918a9fc1a1a1e0a043
* Add tests for ArrayDiffFormatter and DiffOpaddshore2014-02-261-0/+1
| | | | | | | This change also adds some tested getters to the DiffOp class to improve testability of the class Change-Id: I26eafd791b9892f565a18d0502474ef9c24f9a29
* Make setUp and tearDown protected in testsaude2013-11-241-1/+1
| | | | | | | These are protected in the parent MediaWikiTestCase and PHPUnit_Framework_TestCase. No good reason to make them public. Change-Id: I45ecc0e4209f0c3b27e63a550112e4e0ddf6e530
* Fixed spacingumherirrender2013-11-191-3/+3
| | | | | | | | | | | - Removed double spaces - Added space after if/switch/foreach - Removed space on elseif - Added space around parentheses - Added newline at end of file - Removed space before semicolon at end of line Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
* use getOldid and getNewid methods in DifferenceEngineTestaude2013-10-311-2/+2
| | | | | | - instead of direct variable access. Change-Id: I019017ca1b4f3c2a511e703bc65b93a8ce47fae9
* Add tests for DifferenceEngine for revision loadingaude2013-10-301-0/+120
Change-Id: Ia206b396e96b52ba9ac4895aae0f2839dca6f958