aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/rcfeed/RCFeedIntegrationTest.php
Commit message (Collapse)AuthorAgeFilesLines
* recentchanges: Move rcfeed/ to includes/recentchanges/RCFeed/Timo Tijhof2024-08-291-104/+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 and deprecation alias to MachineReadableRCFeedFormatterEbrahim Byagowi2024-05-191-1/+1
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\RCFeed to MachineReadableRCFeedFormatter and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I51110d3b05ae6d2927c49dea5c3fd05f418f595b
* Add namespace and deprecation alias to JSONRCFeedFormatterEbrahim Byagowi2024-05-181-1/+2
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\RCFeed to JSONRCFeedFormatter and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: Ibd3ef6c4e2c9381fd83030e89d6fa645067c02b1
* Add namespace and deprecation alias to FormattedRCFeedEbrahim Byagowi2024-05-171-1/+2
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\RCFeed to FormattedRCFeed and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: Ia929fdc9899a7a5328521fef437e59c4d583b48a
* Add namespace and deprecation alias to RCFeedEbrahim Byagowi2024-05-171-1/+1
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\RCFeed to RCFeed and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I2e63e05901a75d8cf8a1e9d874dc916c0a5749a4
* phpunit: Fix tests relying on implicit wgScript/wgArticlePathTimo Tijhof2024-05-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A number of tests have hardcoded expections that pass only in WMF CI where Quibble has LocalSettings.php with $wgScript and $wgArticlePath set a certain way. We could fix these by adding setMwGlobals() in their tests, as we often do, but these are so often forgotten that I'd rather we just add them to TestSetup.php so that it is simply impossible to write a test that that passes locally for you (if you have the same config) but not for someone else. There is a larger project in there somewhere about expanding this slowly such that we basically only pluck DB-settings and extension enablement from LocalSettings and otherwise run the tests with the default settings in PHPUnit. Pretty much by definition, any (other) setting you have in LocalSettings is irrelevant because it either: 1. has no effect on the test (majority, harmless either way), 2. has a custom default via TestSetup.php (which has precedence over LocalSettings.php), 3. is relevant to the code being tested and the test case correctly calls setMwGlobals() to ensure a consistent value during test. 4. is relevant to the tested code but has no override, thus only passes if you happen to have the "right" value set for it (undesirable). Case 4 is already categorically impossible for the most common config settings that influence random code because we give them a value in TestSetup.php. This patch expands that to include $wgScript and $wgArticlePath. Perhaps in the future we can think about a way to do this automatically by either re-applying MainConfigSchema (sans db settings) or by only selectively applying LocalSettings.php in the first place. This patch follows-up I072ddf89562fe, which added a test case in WikitextContentHandlerIntegrationTest.php that assumed "/index.php" as the value of $wgScript. This passes in WMF CI since Quibble uses that value, but the tests failed in most local development installs since those tend to use "/w" instead. Rather than one-off fixing that one test with overrideConfigValues(), switch to a more general fixture, since the precise values don't matter for this test. Bug: T349087 Bug: T277470 Change-Id: If4304b7ca4a838bd892d4516a0b5c6dfbc30986e
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-5/+5
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Namespace remaining 'specialpage' files under \MediaWiki\SpecialPageJames D. Forrester2023-09-181-0/+1
| | | | | | | SpecialPageFactory is already here, but none of the others were yet. Bug: T166010 Change-Id: I9689bf0a1ab329625e23669b99f019b96295fffd
* Make some methods static in MediaWikiIntegrationTestCaseDaimona Eaytoy2023-08-151-2/+2
| | | | | | | | | | | | Mostly things related to the test database. Also adjust visibility and remove getTestPrefixFor(), which is only used in core according to codesearch. Making a method static is a backwards compatible change, as invoking the method non-statically is valid. Bug: T342259 Change-Id: I6111fb5ff5f3c87d5d3f9188b3f50351391a29c3
* rcfeed: Add 'notify_url' and 'title_url' to MachineReadableRCFeedFormatterTimo Tijhof2023-05-191-3/+5
| | | | | | | | | | | | | | | | | | * 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
* 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
* Migrate from `setMwGlobals()` to `overrideConfigValue(s)`Derick Alangi2022-08-021-12/+15
| | | | Change-Id: I3f167d0e7d59a5aa091c3095a7d96c889d6e7e78
* rcfeed: Deprecate $wgRCEngines and RCFeedEngineTimo Tijhof2022-03-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | Follows-up 39a6e3dc4d (I8be497c623c5d92). * Improve documentation all around and advertise 'class' everywhere instead of 'uri'. * Add test coverage for RCFeed::factory(). * Deprecate the $wgRCEngines "uri to class" mapping in favour of specifying "class" directly in $wgRCFeeds. * Deprecate RCFeedEngine in favour of FormattedRCFeed. Convert to class_alias so that UDPRCFeedEngine no longer has to extend the deprecated class name explicitly (for instanceof compat). * Hard-deprecate RecentChange::getEngine. Bug: T250628 Depends-On: Ie939e1d06b9ee2d841ec7256c8d24cc4e7e386dd Change-Id: Ib6758d724c7200404c89c7ab157aa55f1cad9763
* 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
* 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
* 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
* tests: Add explicit return type void to setUp() and tearDown()Max Semenik2019-10-301-1/+1
| | | | | | Bug: T192167 Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43 Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
* Clear test user registry between testsAryeh Gregor2019-08-141-2/+2
| | | | | | | | | | | | | Otherwise User members will wind up retaining stale references to services. The more things move to services, the more state we need to reset between tests to avoid subtle and confusing test failures! TestUsers can't be created if the DB prefix is not either unittest_ or ut_, which caused failures in RCFeedIntegrationTest.php with this change now that it was trying to create a new TestUser. Fix is to set the prefix to one of those two instead of empty. Change-Id: I41f87e1acffe94361748ef4ab69c290de587e6be
* build: Updating mediawiki/mediawiki-codesniffer to 17.0.0Umherirrender2018-03-291-1/+1
| | | | Change-Id: Ib494b47c54fe6354d166055b1e1b31d3583bb992
* phpunit: Add some @covers and @large/@medium to integration testsTimo Tijhof2018-03-201-9/+6
| | | | | | | | - @small: single class, no I/O (unit test). - @medium: multi-class (partial or no mocks), no I/O (unit/integration test). - @large: multi-class, I/O allowed (integration test). Change-Id: I09317e6dd9b0ee34b7467fbffdd07957ef55dc04
* Use ::class to resolve class names in testsUmherirrender2018-01-261-3/+3
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
* Add missing @group Database tags in testsaude2017-03-181-0/+3
| | | | Change-Id: Id92aab0b1f8cde6657d6558d0d82605109daa588
* Refactor RCFeed configuration (backwards compatible)Timo Tijhof2017-02-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously: * Engines had to be registered in $wgRCEngines. * The RCFeedEngine classes took no constructor arguments and were expected to send whatever text is previously formatted without any information about it. This generic design was flexible in allowing one to use any formatter with any engine with minimal configuration and no need for additional classes. * Each feed configured their destination by setting a 'uri' option that encodes the name of the engine in PHP as the uri scheme. Other uri components had to be used for any other parameters to the engine (host, port, path). While fairly limited, it was sufficient for the default engines in core. Changes: * Allow feed classes to be directly associated with a feed in $wgRCFeeds via a new 'class' option - without the indirection of 'uri' and $wgRCEngines. All options are passed to the given class constructor. This matches the design used elsewhere in MediaWiki. (ObjectCache, FileRepo, FileBackend, JobQueue, LBFactory, etc.) This means we no longer enforce a 1:1 mapping of internet protocols to a specific feed engine, and it allows settings to be passed without being encoded as a URI neccecarily. Main use case for this refactor is EventBus (see I7edc4d57fa), Interestingly, this matches the (then incorrect) documentation written for $wgRCFeeds in 2961884b43 (which mentions an 'engine' property that would do the same thing). * Move the default 'omit' filters and unrestricted 'formatter' handling to a new FormattedRCFeed class, which remains the default. * Deprecate RecentChange::getEngine() in favour of RCFeed::factory(). * Document wgRCEngines as "@since 1.22". Follows 2961884b43, ffc71cb6af. Change-Id: I8be497c623c5d928762e3d3406a388f4d91add9a
* rcfeed: Add basic PHPUnit integration testTimo Tijhof2017-01-261-0/+96
Change-Id: Ifb5ddd4bda6cd1be050da7a5419ebe90f5ecf60f