aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/changes/EnhancedChangesListTest.php
Commit message (Collapse)AuthorAgeFilesLines
* recentchanges: Move rcfeed/ to includes/recentchanges/RCFeed/Timo Tijhof2024-08-291-298/+0
| | | | | | | | | | | | | | | | It is part of the component at https://phabricator.wikimedia.org/tag/mediawiki-recent-changes/ and https://www.mediawiki.org/wiki/Developers/Maintainers and since Ifac20da51f7e809f under the same "Recent changes" doc group. The Maintainers list oddly enough lists only rcfeed and completely forgets the majority of it under /includes/changes (or now, /includes/recentchanges). Bug: T364652 Change-Id: I94e6705672c1e2821bdc726aa7a383d9e7c1f7b5
* Add namespace to WikitextContentEbrahim Byagowi2024-08-061-0/+1
| | | | | | | It adds MediaWiki\Content namespace to WikitextContent and two classes related. Change-Id: Ib74e4c5b3edac6aa0e35d3b2093ce1d0b794cb6d
* 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
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-191-0/+1
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* EnhancedChangesList: Use HTML/CSS for collapsingFomafix2023-07-131-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The collapsing on the enhanced changes list now works without JavaScript. Keyboard navigation is still supported but only the space and not the return toggles the collapsing toggle button. The <input type="checkbox"> element needs an unique identifier in the `id` attribute and the same value must be in the `for` attribute of the <label> element. A simple counter in the class EnhancedChangesList starts twice from the beginning if the recent changes get included as: {{Special:RecentChanges|enhanced=1}} {{Special:RecentChanges|enhanced=1}} Therefore a random value is used as checkbox identifier. The module 'jquery.makeCollapsible' and its classes `mw-collapsible`, `mw-collapsed` and `mw-collapsible-toggle-collapsed` are not needed anymore. The icons from module 'mediawiki.icon' are directly included because the module has fixed selectors which do not fit here. Bug: T172618 Change-Id: Iafd27e5d760b78ae386d833946005f86cee8dd64
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+2
| | | | | | | | | | | | | | | | | | | 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
* tests: Replace assertRegExp with assertMatchesRegularExpressionDaimona Eaytoy2022-10-071-4/+4
| | | | | | | | | | | | | | | | | | And also assertNotRegExp -> assertDoesNotMatchRegularExpression. The methods were renamed in PHPUnit 9. Done automatically with: grep -rl assertRegExp tests/ | xargs sed -r -i "s/>assertRegExp\(/>assertMatchesRegularExpression\(/" grep -rl assertNotRegExp tests/ | xargs sed -r -i "s/>assertNotRegExp\(/>assertDoesNotMatchRegularExpression\(/" Split out from Ifdba0f9e98eb6bce4590b7eb73170c51a697d7c6 so that it remains smaller and easier to review. Also make a test use MediaWikiUnitTestCase (it's already in the unit/ dir) so that it can access the forward-compat method. Bug: T243600 Change-Id: Ifa279d5f201d7abeebece292141ebface8278046
* tests: Use Title::makeTitle instead of Title::newFromTextUmherirrender2022-07-061-3/+3
| | | | | | Avoid parsing known titles in tests to improve performance Change-Id: Ibfccfe696f0b8bfda0b99abae324e60bbecef7d8
* tests: Use WikiPageFactory to create WikiPage objectUmherirrender2022-06-261-2/+2
| | | | | Bug: T259948 Change-Id: I9afcf3b845306f81ee5ca156553256e6c38df3a0
* 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-2/+10
| | | | | | | | Results in passing a user where previously the fallback to $wgUser was being used, mostly in tests. Bug: T255507 Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
* Replace PHPUnit ->returnValue() with ->willReturn() shortcutThiemo Kreuz2021-04-221-1/+1
| | | | | | | | | | | | It's the same and makes the test code much more readable, I would like to argue. Because of the was I split all the changes I made into smaller patches this patch contains some other changes in the same lines where I could not split them off. E.g. removal of ->any(), which is the default anyway and doesn't do anything. Change-Id: Ib297b989d4aec33b31a4e33fe9d5032865b39be0
* 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
* Remove constructors from test classesDannyS7122021-03-081-3/+2
| | | | | | | Tests should put their setup code in ::setUp(), rather than __construct Change-Id: I622f017f3c78a72acc65310f37d61dbec2a5da79
* Tests: Mark more more closures as staticUmherirrender2021-02-091-2/+2
| | | | | | | Result of a new sniff I25a17fb22b6b669e817317a0f45051ae9c608208 Bug: T274036 Change-Id: I695873737167a75f0d94901fa40383a33984ca55
* Add missing @param and @return to documentation in testsUmherirrender2021-01-221-0/+5
| | | | Change-Id: Ic663e81cca0bf007804a70772250914a85f1fef4
* Fix watchlist query and filters for RecentChangesSam Wilson2020-07-281-0/+1
| | | | | | | | | | This query was correctly excluding expired items from RC, but it was failing to include them when the unwatched filter was set. This is a follow-up to https://gerrit.wikimedia.org/r/c/mediawiki/core/+/602211 Bug: T252136 Change-Id: I5d43d746df21cc3674eb2e92c3f604b7c87b7d1a
* Add clock icon to expiring items in Special:WatchlistSam Wilson2020-06-191-0/+42
| | | | | | | | | If a changeslist item has an expiry date, add a grey clock icon after the page title, with a tooltip indicating when the item expires. Bug: T250212 Change-Id: I38f8c85321cf257eeea8de5a3bd73bbc0b5ea393
* Add tests for Hook run call sitesNikki Nikkhoui2020-05-141-0/+19
| | | | | | | Add a few tests for hook run call sites to ensure hookrunner is executed and with the correct arguments. Change-Id: Icb90f1caca7c159f6f753e28e01b139e5c741500
* EnhancedChangesList: add screen reader support to live changesAbbe982020-03-101-1/+1
| | | | | | Expose EnhancedChangesList content to assistive technology as it's updated. Change-Id: I5b9744075bf7ab03388ed7f827a171b6c253de8d
* Stop using assertContains with string haystackDaimona Eaytoy2019-12-151-5/+5
| | | | | | | | This was done automatically by replacing every assertContains with string *needle*. Then verifying the results. Bug: T192167 Change-Id: Id8cbbf3b01e948f80046714183cc299f86be21fd
* Autofix 94 PHPUnit 8 compat issuesDaimona Eaytoy2019-12-131-1/+1
| | | | | | | | Done automatically using the master version of MW codesniffer and running composer fix. Bug: T192167 Change-Id: If6b40f515fde32ab5eff074a90e821c30c791827
* tests: Prefer PHPUnit's assertSame() when comparing empty stringsThiemo Kreuz2019-09-201-1/+1
| | | | | | | | assertSame() is guaranteed to never do any magic type conversion. This can be critical when accidentially comparing empty strings (a value PHP considers to be "falsy") to false, 0, 0.0, null, and such. Change-Id: I2e2685c5992cae252f629a68ffe1a049f2e5ed1b
* RecentChanges updated to use pseudo elements for presentationjdlrobson2019-04-021-2/+2
| | | | | Bug: T219348 Change-Id: I6eeeaa3b58d37adb7fefb4cc6915022229b3b324
* EnhancedChangesList: Load style module via addModuleStyles()Fomafix2019-02-121-1/+6
| | | | | | | This change avoids a flash of missing collapsible toggle icons while loading. Change-Id: I090b1622868f2e5a01ca783dfce3be16b7d6b525
* Unwatch link for pages in Special:WatchlistGeoffrey Mon2017-08-121-2/+47
| | | | | | | | | | | | | | | | | | | When the 'watchlistunwatchlinks' preference option is enabled, this adds a '×' link to each entry of the watchlist that unwatches the page of that entry. When clicked, it changes into a '+' which can be used to re-watch the page (effectively undoing the earlier unwatch). When a page is unwatched, its entries and the entries of its associated talk page (or vice versa) become translucent and are struck through. Without JS, '×'/'+' link to action=(un)watch for the relevant page. In addition, ChangesList classes have been modified to allow a prefixer that adds a prefix to each line (used in this case to put the unwatch link) and to add HTML data attributes to reliably determine the target page of each entry. Unit tests have been updated accordingly. Bug: T2424 Change-Id: I450b2901413d7e75c11de2a446829fdbb22d31e1
* Make phpcs passUmherirrender2017-08-111-1/+4
| | | | | | | | Reenable MediaWiki.WhiteSpace.SpaceBeforeClassBrace.NoSpaceBeforeBrace, because the mentioned bug is fixed Bug: T172933 Change-Id: I1593bdba2295ebed401b921f2beabed69dba7638
* RCFilters: show new changesStephane Bisson2017-07-311-2/+2
| | | | | | | | | | | When "live update" is off and new changes are detected, show a link to load and prepend the changes to the list. Also adding a line between old and new changes when grouping by pages is off. Bug: T163426 Change-Id: I6a111d23956bdc04caa4c71e9deede056779aafa
* Fix enhanced RC data attribute sanitizingGergő Tisza2017-06-151-1/+1
| | | | | | | | | | | | We push 'class' in the attribute array so the hook can manipulate it, so it needs to be added to the attribute whitelist as well. Broken in I6dd006d0b1b0fd35c0020f0f9eea9113eca30b35. Bug: T167922 Bug: T167535 Change-Id: Ic24400382a9dcbb990e12dfddae4ab7db14553cc
* ChangesList: Expose basic properties of lines as data attributesGergő Tisza2017-06-081-0/+19
| | | | | | | | | | | | | | | | | | | | | | We have several types of change lists (old RC/watchlist/related changes, enhanced RC/watchlist, history) with slightly different HTML, each with their own idiosyncracies. JavaScript code trying to identify lines by log ID / revision ID has to jump through all kinds of hoops to work with that. To simplify the lives of frontend / gadget maintainers and provide something approaching an API for these pages, we now expose the basic attributes of each change line (revision ID for edits, log type/action and ID for log events) as data attributes. The OldChangesListRecentChangesLine, EnhancedChangesListModifyLineData, EnhancedChangesListModifyBlockLineData, PageHistoryLine, ContributionsLineEnding and DeletedContributionsLineEnding hooks are updated accordingly. New hooks (LogEventsListLineEnding and NewPagesLineEnding) are added for the change list pages which did not yet have them. Change-Id: I6dd006d0b1b0fd35c0020f0f9eea9113eca30b35
* Whenever possible, reuse User objects in unit testsOri Livneh2016-05-261-15/+2
| | | | | | | | | | | | | The unit tests spend nearly half of their run time resetting the user table for each test. But the majority of tests do not depend on the user table having the exact value that the setup code resets it to, and do not need to modify the user objects they require to run. Fix that by providing an API for tests to get User objects, and to indicate whether the User object will be subject to destructive modification or not. This allows User objects to be reused across multiple unit tests. Change-Id: I17ef1f519759c5e7796c259282afe730ef722e96
* Convert all array() syntax to []Kunal Mehta2016-02-171-2/+2
| | | | | | | | | | 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
* Enable users to watch category membership changes #2addshore2015-10-201-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of a chain that reverts: e412ff5ecc900991cce4f99b7a069f625a5694b3. NOTE: - The feature is disabled by default - User settings default to hiding changes - T109707 Touching a file on wikisource adds and removes it from a category... Even when page has no changes.... WTF? See linked issue, marked as stalled with a possible way forward for this patch. @see https://gerrit.wikimedia.org/r/#/c/235467/ Changes since version 1: - T109604 - Page names in comment are no longer url encoded / have _'s - T109638 & T110338 - Reserved username now used when we can't determine a username for the change (we could perhaps set the user and id to be blank in the RC table, but who knows what this might do) - T109688 - History links are now disabled in RC.... (could be fine for the introduction and worked on more in the future) - Categorization changes are now always patrolled - Touching on T109672 in this change emails will never be sent regarding categorization changes. (this can of course be changed in a followup) - Added $wgRCWatchCategoryMembership defaulting to true for enabling / disabling the feature - T109700 - for cases when no revision was retrieved for a category change set the bot flag to true. This means all changes caused by parser functions & Lua will be marked as bot, as will changes that cant find their revision due to slave lag.. Bug: T9148 Bug: T109604 Bug: T109638 Bug: T109688 Bug: T109700 Bug: T110338 Bug: T110340 Change-Id: I51c2c1254de862f24a26ef9dbbf027c6c83e9063
* Revert "Enable users to watch category membership changes"CSteipp2015-08-201-43/+0
| | | | | | | This reverts commit f6879ea16edf008eb012bd4dbe133e2ba4b9338f. Bug: T109638 Change-Id: I770d8d33a4cff3829bdea9a4df24de209cbe691b
* Enable users to watch category membership changesKai_WMDE2015-08-131-0/+43
| | | | | Bug: T9148 Change-Id: I5a89d8f19804b1120f4c755d834e2da6ca12ceae
* 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
* Fixed spacingumherirrender2014-09-291-6/+6
| | | | | | | | | | - Added newline at end of file - Removed double spaces/newlines - Added space after if/function and parentheses/brackets - Removed space before comma/cast - Fixed indent of some lines Change-Id: I29867ffdffdfb7d2b56997e9393497c7dc12f7d3
* Add basic tests for EnhancedChangesListaude2014-08-291-0/+132
Change-Id: Ic440a40652dcd10a6bc6bbf4237255ae9a0ef04a