aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api/ApiComparePagesTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Add namespace to includes/api classesJames D. Forrester2024-09-251-2/+2
| | | | | Bug: T353458 Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
* tests/api: Add missing documentation to class propertiesUmherirrender2024-09-101-0/+1
| | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Change-Id: I48014b6464f3e7e2b7f083e67f517af0b1a9367e
* Merge "ApiComparePagesTest: Disable temp accounts for anon tests"jenkins-bot2024-06-251-0/+4
|\
| * ApiComparePagesTest: Disable temp accounts for anon testsKosta Harlan2024-06-251-0/+4
| | | | | | | | | | Bug: T365669 Change-Id: I3b641fe8e93e3a302092c5097e87b4c3de2e7225
* | Replace db with getDb for TestsWandji692024-06-231-2/+2
|/ | | | | Bug: T316841 Change-Id: I29e535e8ee9b5641a4546d53b98cd5060d39681d
* tests: Migrate to IDatabase::newUpdateQueryBuilderUmherirrender2024-04-141-9/+12
| | | | | Bug: T353219 Change-Id: Icecc444e6b4d6d2e9f4b13cda2931b10bb753318
* Migrate to IDatabase::newDeleteQueryBuilderUmherirrender2024-04-121-1/+5
| | | | Change-Id: Idf42d67c1b0b311f81a1d60a7a8a6f875f99e864
* tests: Namespace api testsReedy2024-02-181-0/+4
| | | | | Bug: T357823 Change-Id: I0d7cc2c9b166d5e5b913c1305f7cee017fe377af
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-1/+1
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Namespace includes/contextJames D. Forrester2024-02-081-0/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* tests: Use $this->getDb() instead of wfGetDB() in integration testsAmir Sarabadani2023-09-251-2/+2
| | | | | | | Deprecated long time ago. Bug: T330641 Change-Id: Ia57f12d350c3346029aafae25534c9ed262a7e98
* Namespace TitleValue under \MediaWiki\TitleJames D. Forrester2023-09-181-0/+1
| | | | | | | One of the big ones, so doing this alone. Bug: T166010 Change-Id: I4c901d5c32696d8334ec30cede7d9b6f3d8d645e
* api tests: Call editPage() with WikiPage when used for same pageUmherirrender2023-06-241-3/+4
| | | | | | | | | | | When calling editPage() with a string it converts it to a WikiPage each time it is called. When edit a page only once that is okay, but when adding more revision to the same page it is better to pass a WikiPage instead to allow reuse of internal states of WikiPage to speed up the tests Bug: T225730 Change-Id: I7a0e7e3e75ade5d6abe8e62a03a029190f3b6da8
* HTML: Remove self-closing XHTML syntax from coreVolker E2023-05-031-1/+1
| | | | | | | | | | Syntactical leftover with no significance in modern web. Bug: T309150 Depends-On: I3a029ca950db42b938962b2452ad136ae8ddea6f Depends-On: Id0557ac19583de36d7226b14a4c06933da47fe97 Depends-On: I17580a72e4a9384d7d774866e610197e950900cb Change-Id: I4bbfa47fbf6e30fb90d920d6d02cdf6e0b1cdb46
* API tests: Assert error codes, not error messagesBartosz Dziewoński2023-04-261-1/+1
| | | | | | | | | | | | | | | Error messages are not guaranteed to be stable, and these tests prevent us from improving them. Error codes are supposed to be stable, so we should be asserting that they do not change (especially since many of them are dynamically generated by the dodgy code in ApiMessageTrait). Introduce helpers assertApiErrorCode() and expectApiErrorCode() to be used instead of the usual PHPUnit assertions/expectations for this case. Change-Id: I752f82f29bf5f9405ea117ebf9e5cf70335464ad
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Make use of the new PageUpdateStatusdaniel2022-11-301-1/+1
| | | | | | | | PageUpdateStatus provides clean access the the newly created RevisionRecord. Depends-On: Ia08c586198082ea47e8313d0d41835f9830fb29e Change-Id: Id6963842321c4eaa3d7d029ad0b769f73433c103
* tests: Use Title::makeTitle instead of Title::newFromTextUmherirrender2022-09-231-10/+10
| | | | | | Avoid parsing known titles in tests to improve performance Change-Id: Ie240eb42479d19714e64cc4606e26073fadc2e13
* tests/api: Add TestUser::getAuthority and use itUmherirrender2022-08-061-7/+7
| | | | Change-Id: Icfb66f9927c8e67582010a208538b0b5e0ba353f
* tests/api: Use MediaWikiIntegrationTestCase::editPage for editsUmherirrender2022-08-061-6/+10
| | | | | | | Also improve MediaWikiIntegrationTestCase::editPage by accepting LinkTarget objects and use services instead of static functions Change-Id: I3d036b0837f212d3500159c1d3a3daa4e706882c
* tests: Use `overrideConfig(Value|Values)` where neededDerick Alangi2022-07-121-1/+2
| | | | | | | This patch covers: tests/phpunit/includes/actions/ and tests/phpunit/includes/api/. Change-Id: I60d8fb7b8a63b423606db935fa0d24cf859b2512
* phpcs: Disable `Generic.Files.LineLength` for test filesTimo Tijhof2022-02-181-1/+0
| | | | | | | | | | | There is a common and reasonable need for longer lines in tests. The nudge for shorter lines doesn't seem valuable here. The natural breaks will likely still fall in 80-100 given the enforced practice for non-test code, e.g. whether through habit, or 80-100 column markers in text editors, or the finite width of diff and code review interfaces. Change-Id: I879479e13551789a67624ce66f0946d2f185e6ee
* phpunit: use ->getServiceContainer() in integration testsAlexander Vorwerk2022-01-271-2/+1
| | | | Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
* tests: Replace usages of deprecated WikiPage::doDeleteArticleRealDaimona Eaytoy2022-01-171-2/+4
| | | | | | | | | Add a new helper to MediaWikiIntegrationTestCase, since deleting pages seems to be pretty common in tests. Some calls to WikiPage::factory were also updated to use WikiPageFactory. Change-Id: I5b5100273a00ac292a1900022ca79708fa254347
* Rename diff-related classes for LTR compatibilityDaimona Eaytoy2021-09-171-37/+38
| | | | | | | | | | | | Nothing in the code expects things to be on the left/right, it was just a naming convention. However, it caused some issues because CSSJanus flips the attributes in the stylesheet for RTL languages. So just use more descriptive names that also avoid issues with RTL languages. Bug: T290731 Change-Id: I8a383cd1e3981dc8a826ff60eee523d9f71d1d3d
* Lock selection to a single side in diffsDaimona Eaytoy2021-07-271-35/+35
| | | | | | | | | | | | | | | | This is inspired by the github approach, with some adjustments, simplifications and improvements. This approach should be supported by all grade C browsers, except for Firefox 27-51. As such, it seems the best solution until we can use the grid layout (T270775). The boilerplate code for the new module was shamelessly stolen from Ied858465c2e938828fc146880827acb6aa15fdd6. Also noting here for posterity: this will NOT work in WMF servers (beta or prod), since we use wikidiff2 to generate diffs there. Bug: T285956 Change-Id: I0cb5f10254af78043b0f6250f7695c6b962fbf6b
* Use WikiPage::doUserEditContent() instead of ::doEditContent()DannyS7122021-06-281-2/+2
| | | | | | | | Results in passing a user where previously the fallback to $wgUser was being used, mostly in tests. Bug: T255507 Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-2/+2
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* Tests: Mark more closures as staticReedy2021-02-071-1/+1
| | | | | Bug: T274036 Change-Id: I911d3041cebe417d162934223b46ea295c6d20e3
* Create diff markers with CSSEd Sanders2020-12-301-35/+35
| | | | | | | Also put <br>s into empty lines so linebreaks are preserved when copying. Bug: T192526 Change-Id: I926bedf71562c74a0aa33fbeb11f8d1a4e4130c7
* TableDiffFormatter: Build HTML using utility classEd Sanders2020-12-291-62/+62
| | | | Change-Id: Idab793bb1aabe8bffcbb2d00f68860d8b05172ef
* Replace uses of Revision constantsDannyS7122020-07-031-6/+8
| | | | | Bug: T257010 Change-Id: Id63123e8b8becd31756d5b68ca11edb238ec8a59
* Remove use of the Revision object returned in WikiPage::doEditContentDannyS7122020-06-091-1/+1
| | | | | | | | Each file's changes are independent and can be reviewed separately Bug: T251853 Bug: T254952 Change-Id: I197c3db4cfb2ead920c8e6071120ae29543ee404
* Added timestamp to action=compareVarun Das2020-04-091-2/+46
| | | | | | | | | Added timestamp props to ApiComparePages.php with value setting only occuring when getTimestamp() does not return null. Added Appropriate tests to ApiComparePagesTest.php Bug: T247686 Change-Id: I15523d11741786f3c5d572a6cff79aef787af78f
* Pass a user to WikiPage::doDeleteArticleReal, use new signatureDannyS7122020-03-191-1/+1
| | | | | | | Don't need to worry about supporting prior versions, since its core Bug: T247869 Change-Id: Iad9397327731817b8c276d0b9786c3bc5ecf6476
* 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
* Drop strings for wgExternalDiffEngine, deprecated in 1.27 and 1.32James D. Forrester2019-10-031-10/+0
| | | | | | | Also move the 'unit' test into integration, given it tests code using globals. Change-Id: Ie039cae9b5d2870c18a6deefec9a73de522dd847
* Ensure calls to Title::getArticleID use the same case as the definitionThalia2019-02-061-7/+7
| | | | Change-Id: Ic92f43c9e9df2782ba20aa28ad9e6d2ef7976d2e
* Merge "ApiComparePages: Don't error with no prev/next rev"jenkins-bot2018-12-181-18/+56
|\
| * ApiComparePages: Don't error with no prev/next revBrad Jorsch2018-10-221-18/+56
| | | | | | | | | | | | | | | | | | | | Prior to I700edfa76, torelative=prev on the first revision of a page would "diff" from an empty revision, and torelative=next on the latest revision would diff to that same latest revision. People were depending on that behavior, so restore it. Bug: T203433 Change-Id: Ie81b58c196998a8047322740fe1d1fa44eff8526
* | ApiComparePages: Don't try to find next/prev of a deleted revisionBrad Jorsch2018-12-031-0/+24
|/ | | | | | | | | | | RevisionStore::getPreviousRevision() and ::getNextRevision() don't handle being passed a RevisionArchiveRecord very well. Even if they would, it's not clear whether the user wants to be comparing with the next/previous deleted revision or the next/previous revision even if not deleted. So let's just make it an error, at least for now. Bug: T208929 Change-Id: I151019e336bda92aa4040ba4162eb2588c909652
* ApiComparePages: Clean up handling of slot deletionBrad Jorsch2018-08-311-0/+10
| | | | | | | | | | | | | We can't allow the main slot to be deleted. DifferenceEngine assumes it exits. We also shouldn't allow parameters such as `tosection-{role}` to be used without the corresponing `totext-{role}`. This will help prevent people from being confused into thinking that `tosection-{role}` will do anything in that situation (as opposed to `tosection`, which did). Bug: T203255 Change-Id: I58573bb2c1ee68e6907ef2e88385fe36e5184076
* ApiComparePages: Update for MCRBrad Jorsch2018-08-231-31/+320
| | | | | | | | | | | | | | | | The main external change here is that it can now return diffs per slot, and the various parameters for providing text are deprecated in favor of templated per-slot versions. Also, this deprecates the 'fromsection' and 'tosection' behavior introduced for T183823 (extracting a section's content for the diff) in favor of the more logical behavior requested in T185723 (expanding 'fromtext-{slot}'/'totext-{slot}' as if for a section edit). Bug: T200569 Bug: T183823 Bug: T185723 Change-Id: I700edfa766bbc320887f2e0b7507fcdb11e72cdc
* Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenientBartosz Dziewoński2018-05-301-1/+1
| | | | | | | | | | | | | | Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
* Merge "ApiComparePages: Add 'fromsection' and 'tosection' parameters"jenkins-bot2018-01-041-0/+43
|\
| * ApiComparePages: Add 'fromsection' and 'tosection' parametersBrad Jorsch2017-12-301-0/+43
| | | | | | | | | | | | | | | | | | The deprecated diffing in prop=revisions and such used a 'rvsection' parameter. To enable migration of things using that, action=compare needs corresponding section parameters. Bug: T183823 Change-Id: If1a0e2df614c083b37640418c69cca367ce0e895
* | build: Updating mediawiki/mediawiki-codesniffer to 15.0.0Umherirrender2018-01-011-3/+2
|/ | | | | | | | | | | | | Clean up use of @codingStandardsIgnore - @codingStandardsIgnoreFile -> phpcs:ignoreFile - @codingStandardsIgnoreLine -> phpcs:ignore - @codingStandardsIgnoreStart -> phpcs:disable - @codingStandardsIgnoreEnd -> phpcs:enable For phpcs:disable always the necessary sniffs are provided. Some start/end pairs are changed to line ignore Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
* Fix inconsistent capitalization of different method callsThiemo Mättig2017-12-271-1/+1
| | | | Change-Id: I9f5b9e59e8cdadf65e80077fe2d3a9822b4592fe
* API: Rewrite ApiComparePagesBrad Jorsch2017-06-051-0/+611
Support diffing deleted revisions, user-supplied text, and additional properties about the diffed revisions such as the user and edit summary. Bug: T20189 Bug: T30047 Bug: T164529 Change-Id: I5565d717d9c2fd19da7cae02890a15e244cc238b