aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/mail/EmailNotificationTest.php
Commit message (Collapse)AuthorAgeFilesLines
* enotif: Retrieve performer and title from RecentChangePiotr Miazga2025-03-211-4/+5
| | | | | | | | | | | | | | | | This is the second step to refactor EmailNotification notifyOnPageChange() method to use single RecentChange object instead multiple arguments. Previously we had to feed $editor, $title and some attributes. Instead we can just pass the entire RecentChange and let EmailNotification decide which properties to use. In the future, this will allow EmailNotification to listen to RecentChange domain events to trigger Notifications. Bug: T388665 Change-Id: I5882531e91cd84c4683522f06d829149fdfc534e
* Pass the RecentChange to NotificationsPiotr Miazga2025-03-211-4/+14
| | | | | | | | | | | | | | | | | | | | | | To evolve Watchlist notifications and provide a unified approach system has to pass the RecentChange object to EmailNotification. Which later will pass to the RecentChange notification. This is required to fulfill Echo needs that requires more information from RecentChange. At current state, Echo requires properties like `rc_logid` which is not available in MediaWiki ENotif job. Furthermore this change will simplify the system, as * instead of passing multiple params (and adding more of them with time) we can just pass one RecentChange object that contains all required information. When passing RecentChange via Job we can use the `rc_id` to recreate the RecentChange when job gets processed. * later Notifications system will be able to listen on RecentChange domain event and trigger notifications via listener pattern which will simplify the system even more. Bug: T388665 Change-Id: I2d17bd3743e590e06298efaac387fc6d64e3609d
* tests: Add missing documentation to class propertiesUmherirrender2024-09-181-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: Ifc27750207edc09e94af030d882b6f1a5369cf98
* mail: Improve docs, fix file headers, widen `@covers`Timo Tijhof2024-05-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add missing `ingroup` to class blocks (and remove from any file blocks) as otherwise the file is indexed twice (e.g. in Doxygen) which makes navigation on doc.wikimedia.org rather messy. Remove duplicate descriptions from file blocks in favour of class doc blocks. This reduces needless duplication and was often incorrect or outdated, and helps make file headers more consistently (visually) ignorable. Ref https://gerrit.wikimedia.org/r/q/message:ingroup+is:merged * Widen `@covers` tags in phpunit tests Given all called methods are de-facto and liberally claimed, and that we keep the coverage limited to the subject class, it maintains the spirit and intent by listing the class explicitly instead. PHPUnit offers a more precise tool when you need it (i.e. when testing legacy monster/god classes), but for well-written code, the class-wide tag is exactly what you want. We lose useful coverage and waste valuable time on keeping tags accurate through refactors (or worse, forget to do so). Tracking tiny per-method details wastes time in realizing (and fixing) when people inevitably don't keep them in sync, and time lost in finding uncovered code to write tests to realize it was already covered but "not yet claimed". Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:Widen While at it, improve purposes and explainations of several mail-related classes, and set `@since`: - EmailNotification introduced in r22110 (1.11.0), git a6f6e04841, later moved to a separate file in bf8810d6bc (Ic435bbdbb6). - MailAddress introduced in r12082 (1.6.0, 1.5.7), git 5cfddf9a82. - UserMailer converted to class with ::send in r26357 (1.12.0), git 353f203ce2. Change-Id: I1216781240bcfabdebf109cef8f995355db0f659
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-1/+1
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Follow-up 71ff05267: Stop writing to tablesUsed in tests, now unnecessaryJames D. Forrester2023-11-211-5/+0
| | | | | Bug: T342301 Change-Id: I5ea01f7ee103570165261bde0965c5b65e04c369
* EmailNotificationTest: Expand coverage to be more accurateJames D. Forrester2023-10-301-3/+1
| | | | | | | PHPUnit won't spot the private method coverage if we only cover the public methods directly, rather than the class. Change-Id: I08fabab1eca5bfca1653a366ab9c439ea2eb8f53
* 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
* tests: Add missing @group DatabaseUmherirrender2022-08-061-0/+3
| | | | | | | $tablesUsed does not let the test run in the correct group in CI Fix casing and remove duplicate as well Change-Id: Id9e092865464de4900965840834d946925c728e5
* Migrate usage of `setMwGlobals()` to `overrideConfigValue(s)`Derick Alangi2022-08-011-3/+3
| | | | Change-Id: I49d97864d8f9d8cadf01b0c0dc653fbac4ca9e94
* tests: Use Title::makeTitle instead of Title::newFromTextUmherirrender2022-07-061-1/+1
| | | | | | Avoid parsing known titles in tests to improve performance Change-Id: Ibfccfe696f0b8bfda0b99abae324e60bbecef7d8
* phpunit: use ->getServiceContainer() in integration testsAlexander Vorwerk2022-01-271-3/+1
| | | | Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
* 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
* Filter out expired watched items when sending email notificationsMusikAnimal2020-06-241-0/+59
Bug: T253035 Change-Id: I9ebfee4042b6ac40726162fa8c887f757d7528b8