aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/changes/RecentChangeTest.php
Commit message (Collapse)AuthorAgeFilesLines
* recentchanges: Move rcfeed/ to includes/recentchanges/RCFeed/Timo Tijhof2024-08-291-623/+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
* RecentChange: Replace use of legacy error arraysBartosz Dziewoński2024-07-091-22/+21
| | | | | | | | | | | Replace uses of soon-to-be-deprecated methods: * ApiBase::errorArrayToStatus * PermissionStatus::toLegacyErrorArray Deprecate and replace uses of: * RecentChange::doMarkPatrolled Change-Id: I2311d1fa3772ba6be378ad6f497ed4c0df9b7aa8
* RecentChangeTest#testDatabaseRoundTrip: Conditionally disable temp user featureKosta Harlan2024-06-271-1/+7
| | | | | | | | | | | | | Why: - We cannot save an RC entry when temp user feature is enabled What: - Disable auto-create temp user when the user ID in a test case is 0 Bug: T365669 Change-Id: I4191416cb9b80713ed67db71bcd0c7d68c95dde6
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-33/+33
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* tests: Set rc_log_type in RecentChangeTest for log eventsUmherirrender2023-12-121-0/+4
| | | | | | | | | When running tests together with the CheckUser extension there is a database error, for RC_LOG both fields must be not-null Error 1048: Column 'cupe_log_type' cannot be null Function: MediaWiki\CheckUser\Hooks::updateCheckUserData Change-Id: I188df89b75a57aa1cc82c77f5c925bee634501cb
* Drop RecentChange::getPerformer(), deprecated since 1.36James D. Forrester2023-09-271-17/+0
| | | | Change-Id: I10cd61f6088da3069d7e29e5fe4355747e83236e
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* rcfeed: Add 'notify_url' and 'title_url' to MachineReadableRCFeedFormatterTimo Tijhof2023-05-191-1/+90
| | | | | | | | | | | | | | | | | | * Move the current URL logic from IRCColourfulRCFeedFormatter to a new method RecentChange::getNotifyUrl (covered by tests now). * Re-use this method in MachineReadableRCFeedFormatter so that the diff/patrol/rcid etc URL is also available in the modern JSON-based EventStreams service. And in particular to allow porting of the legacy irc.wikimedia.org backend to a much simpler one that is based on this. * Also expose a title_url field which was previously missing, and made consumption of the data needlessly difficult. Bug: T234234 Depends-On: Id740134ef30b2276688d7b7caedb6bb652158761 Change-Id: Ic3e0aebdb61b5c0e5fbed08656db4a1e90b67518
* tests: Make some PHPUnit data providers staticTim Starling2023-03-241-5/+5
| | | | | | | | | | | | | Just methods where adding "static" to the declaration was enough, I didn't do anything with providers that used $this. Initially by search and replace. There were many mistakes which I found mostly by running the PHPStorm inspection which searches for $this usage in a static method. Later I used the PHPStorm "make static" action which avoids the more obvious mistakes. Bug: T332865 Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
* Allow marking recent changes about logged actions with bot flagMatěj Suchánek2023-03-131-1/+8
| | | | | | | | | There was no clean way to do this but using the global state. The parameter is three-state to keep backward compatibility. Bug: T304428 Change-Id: I01c5f8e9646cbe861516100c3b8d165aefb95ca0
* 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
* Merge "Reorg: Move PageProps to page/ and namespace it to MediaWiki\Page\"jenkins-bot2022-12-111-0/+1
|\
| * Reorg: Move PageProps to page/ and namespace it to MediaWiki\Page\Amir Sarabadani2022-12-091-0/+1
| | | | | | | | | | | | | | | | We should slowly migrate page/ to have proper namespace too but that'll be pretty big. Bug: T321882 Change-Id: I3e57be8aa8ac08971f190233196e84ea33023d4a
* | Suppress RecentChange::doMarkPatrolled when autopatrol is requestedMatěj Suchánek2022-12-031-24/+6
|/ | | | | | | | | | | | | | The result of the method has been inappropriate and surprising since rc_patrolled was changed to distinguish between manually patrolled and autopatrolled changes (T184791). When called with $auto = true, it would mark the change as manually patrolled (not autopatrolled), but it would not log it as such in patrol log and would still require 'autopatrol' right (not 'patrol'). Change-Id: I0bd6f2cf317d2b1c8dd50b7998724a57f5f549fb
* tests: Replace assertEmpty with assertSameUmherirrender2022-11-251-1/+1
| | | | | | | assertSame avoids use of loose comparisons and allows to check the expected type Change-Id: If821d1be2bc1ff9f8b70968a339f33c7a8e8880a
* tests: Migrate `setMwGlobals()` to `overrideConfigValue(s)()`Derick Alangi2022-07-231-4/+3
| | | | | | | | | | | | | | Directories covered are: - tests/phpunit/includes/cache/ - tests/phpunit/includes/changes/ - tests/phpunit/includes/changetags/ - tests/phpunit/includes/config/ - tests/phpunit/includes/content/ - tests/phpunit/includes/debug/ - tests/phpunit/includes/deferred/ - tests/phpunit/includes/diff/ Change-Id: I3a1f586867db7d57b177e13a03a4593f7eed09f4
* Replace trivial usa of mock builder with createMock() shortcutThiemo Kreuz2022-07-151-11/+1
| | | | | | | | | | | createMock() does the same, but is much easier to read. A small difference is that some of the replacements made in this patch didn't use disableOriginalConstructor() before. In case this was relevant we should see the respective test fail. If not we can save some CPU cycles and skip these constructors. Change-Id: Ib98fb06e0fe753b7a53cb087a47e1159515a8ad5
* tests: Use Title::makeTitle instead of Title::newFromTextUmherirrender2022-07-061-1/+1
| | | | | | Avoid parsing known titles in tests to improve performance Change-Id: Ibfccfe696f0b8bfda0b99abae324e60bbecef7d8
* tests: Change use of AtEase to at operatorTimo Tijhof2022-02-241-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Follows-up I361fde0de7f4406bce6ed075ed397effa5be3359. Per T253461, not mass-changing source code, but the use of the native error silencing operator (@) is especially useful in tests because: 1. It requires any/all statements to be explicitly marked. The suppressWarnings/restoreWarnings sections encourage developers to be "lazy" and thus encapsulate more than needed if there are multiple ones near each other, which would ignore potentially important warnings in a test case, which is generally exactly the time when it is really useful to get warnings etc. 2. It avoids leaking state, for example in LBFactoryTest the assertFalse call would throw a PHPUnit assertion error (not meant to be caught by the local catch), and thus won't reach AtEase::restoreWarnings. This then causes later code to end up in a mismatching state and creates a confusing error_reporting state. See .phpcs.xml, where the at operator is allowed for all test code. Change-Id: I68d1725d685e0a7586468bc9de6dc29ceea31b8a
* tests: Replace some usages of Wikimedia\(suppress|restore)Warnings()Reedy2022-02-241-2/+3
| | | | Change-Id: I361fde0de7f4406bce6ed075ed397effa5be3359
* 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
* Hard deprecate RecentChange::getPerformer()Roman Stolar2021-06-021-0/+5
| | | | | | | Added deprecation warning Bug: T276412 Change-Id: I642a2903f7a1d6861dd5e50e8754980adc937c53
* build: Upgrade mediawiki-codesniffer from v35.0.0 to v36.0.0James D. Forrester2021-04-291-2/+2
| | | | Change-Id: I8905d0d69738a1cd6997c104080fdf128d315e8b
* Merge "RecentChange: replace Title in method signatures"jenkins-bot2021-04-261-53/+109
|\
| * RecentChange: replace Title in method signaturesdaniel2021-04-261-53/+109
| | | | | | | | | | Bug: T278459 Change-Id: I144ea130f29ec437302649d86494034af044c524
* | 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
* Remove $actor field from UsererIdentityValuedaniel2021-04-131-2/+2
| | | | | | | | | | | | | | | | | Code that needs to store an actor ID in the database to represent a UserIdentity, or needs to construct a UserIdentity based on an actor ID loaded from the database, should use the ActorNormalization service. Note: The getActorId() method is removed from the UserIdentity interface, but all concrete classes continue to support it for now. UsererIdentityValue::getActorId() is hard deprecated and should be removed in 1.37. It always returns 0. User::getActorId() is not deprecated at this point. Bug: T274179 Depends-On: Id2b3ddf6a2a7cdf90f8936a69148d2cce6fde237 Change-Id: I9925906d11e47efaec3c1f48d5cb3f9896a982c1
* Convert RecentChange to use UserIdentity and ActorStoredaniel2021-03-111-8/+191
| | | | | | | | | Note: this removes 'rc_actor' from the public attributes array. There is no access to this field in any known extension. It seemed to be there purely by analogy to the database schema. Bug: T276853 Change-Id: Ib9fe44567660ec1e42cc788f69b9a4101a8a3460
* Convert RecentChange::doMarkPatrolled to AuthorityPetr Pchelko2021-03-031-1/+109
| | | | Change-Id: If93d6133f61bf0801bbe979885e2fb120e01a33d
* RecentChangeTest::testParseParams use a data providerDannyS7122021-03-011-29/+16
| | | | | | Reduces code duplication Change-Id: I9e200bfe8d5b8f3b5ac732ea3498c09883b23645
* Convert PageProps to a serviceDannyS7122020-08-121-4/+1
| | | | | Bug: T253188 Change-Id: Ic358946099a3424a3d1c2615feb14e74b6336a0e
* 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
* Fix visibility of setUp/tearDownThiemo Kreuz2020-06-161-1/+1
| | | | Change-Id: I636be48eb9f713680abac35d46091f7b49374696
* Replace all `new stdClass()` with identical `(object)[]`Thiemo Kreuz2020-03-041-13/+15
| | | | | | | | | | | | This should be the exact same. Its more a style change than anything. So why do it then? * I believe this is much less confusing than code mentioning a weird "standard class". Barely anybody knows what this is, and what the difference between "object" and "stdClass" is. * The code is shorter. * It's even faster. In my micro benchmark it's twice as fast. Change-Id: I7ee0e8ae6d9264a89b6cd1dd861f0466ae620ccc
* tests: Add explicit return type void to setUp() and tearDown()Max Semenik2019-10-301-1/+1
| | | | | | Bug: T192167 Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43 Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
* Update tests to use PHPUnit 6 class namesMax Semenik2019-10-061-1/+2
| | | | | Bug: T192167 Change-Id: I42b0c8908b4968b95b08f861a40af18dc79fa0a1
* Add missing newline between <?php and namespace/use sectionThiemo Kreuz2019-06-031-0/+1
| | | | | | The rest of the codebase is using this code formatting standard. Change-Id: I4d2ba61757a7e28d40096d9dc5915005c340d4f2
* Add `actor` table and code to start using itBrad Jorsch2018-02-231-0/+11
| | | | | | | | | | | | | Storing the user name or IP in every row in large tables like revision and logging takes up space and makes operations on these tables slower. This patch begins the process of moving those into one "actor" table which other tables can reference with a single integer field. A subsequent patch will remove the old columns. Bug: T167246 Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50 Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
* Update suppressWarning()/restoreWarning() callsReedy2018-02-101-2/+2
| | | | | Bug: T182273 Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
* Add `comment` table and code to start using itBrad Jorsch2017-08-301-0/+25
| | | | | | | A subsequent patch will remove the old columns. Bug: T166732 Change-Id: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
* phpunit: Fix RecentChangeTest failure when coverage is enabledTimo Tijhof2017-03-201-6/+9
| | | | | | | | | | | | From <https://integration.wikimedia.org/ci/job/mediawiki-core-code-coverage/> 2) RecentChangeTest::testIsInRCLifespan with data set #0 (6000, 1490019080, 0, true) Failed asserting that false matches expected true. 3) RecentChangeTest::testIsInRCLifespan with data set #3 (3000, 1490016080, 6000, true) Failed asserting that false matches expected true. Change-Id: I309bb229542f3af62e3e83025d88e77ecb55cd31
* Use namespaced ScopedCallbackKunal Mehta2016-10-171-0/+1
| | | | | | The un-namespaced \ScopedCallback is deprecated. Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
* Update mediawiki/mediawiki-codesniffer to 0.7.1Paladox2016-05-071-1/+1
| | | | | | | | This also fixes some code style errors. This also include a performance increase in running phpcs, performance increase was done by addshore :). Change-Id: I74a3d3134791ac22c332bb4fa0bc5c3662599394
* Hide hiddencat catwatch changes in special changelistsWMDE-Fisch2016-04-181-0/+47
| | | | | | | | | | | | | | If a hidden category has a member added or removed this will only be shown to users that have the user preference "display hidden categories". Also added method to WikiCategoryPage to check for hidden status. Added unit tests for both. Bug: T127944 Change-Id: Ic53d51391fa29d5e18fef4c42b8a275816c7ba4a
* Convert all array() syntax to []Kunal Mehta2016-02-171-20/+20
| | | | | | | | | | 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
* Introduce CategoryMembershipChangeaddshore2015-09-291-0/+1
| | | | | | | This is split from: I03516bb34144d95e5f25c46ae98ab70ce699b31b Change-Id: I27539d25ef3e81cf991657dffc0a62b9719d21d8
* Move LogFormatter test comment blockaddshore2015-09-251-38/+0
| | | | | | | | This was missed in: https://gerrit.wikimedia.org/r/#/c/239783/ Ia5016c82c00dd7c35a6f1253d6e385b587ec485e Change-Id: Ibf537aaca2a0ca9d2c509499f6da5b9e51b06037
* Add tests for RecentChange::parse(To|From)RCTypeaddshore2015-09-211-0/+25
| | | | Change-Id: I60278aaeef475ed3ec1515b1f5f28d6afcc700c5
* Add test for RecentChange::newFromRowaddshore2015-09-211-0/+20
| | | | Change-Id: I1e21d296e15c1b6d18f19ae9cc7038387c8f4e2b
* Add test for RecentChange::isInRCLifespanaddshore2015-09-211-0/+22
| | | | Change-Id: I0eac57d0cfabba3ed9b5b430e9972e7c5c0b9f8b