aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPiotr Miazga <pmiazga@wikimedia.org>2025-03-21 13:57:30 +0100
committerPiotr Miazga <pmiazga@wikimedia.org>2025-03-21 18:31:35 +0100
commit61bf41f4b968f2e5bba4f7b5fce08174cb1cba98 (patch)
treefbd6429adfcb1181c50a5bef886e2922dfc772cc /tests
parente405ad2449896cb97de1eddaa4c9d49a4f114aa8 (diff)
downloadmediawikicore-61bf41f4b968f2e5bba4f7b5fce08174cb1cba98.tar.gz
mediawikicore-61bf41f4b968f2e5bba4f7b5fce08174cb1cba98.zip
enotif: Retrieve performer and title from RecentChange
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
Diffstat (limited to 'tests')
-rw-r--r--tests/phpunit/includes/mail/EmailNotificationTest.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/phpunit/includes/mail/EmailNotificationTest.php b/tests/phpunit/includes/mail/EmailNotificationTest.php
index 4718b635947b..70061b93da80 100644
--- a/tests/phpunit/includes/mail/EmailNotificationTest.php
+++ b/tests/phpunit/includes/mail/EmailNotificationTest.php
@@ -37,19 +37,20 @@ class EmailNotificationTest extends MediaWikiIntegrationTestCase {
'rc_timestamp' => '20200624000000',
'rc_comment' => '',
'rc_minor' => false,
-
+ 'rc_title' => $title->getDBkey(),
+ 'rc_namespace' => $title->getNamespace(),
'rc_deleted' => false,
'rc_last_oldid' => false,
'rc_user' => $alice->getId(),
];
$rc = @RecentChange::newFromRow( $row );
- $sent = $this->emailNotification->notifyOnPageChange( $alice, $title, $rc );
+ $sent = $this->emailNotification->notifyOnPageChange( $rc );
static::assertTrue( $sent );
// Alice edits again, but Bob shouldn't be notified again
// (only one email until Bob visits the page again).
- $sent = $this->emailNotification->notifyOnPageChange( $alice, $title, $rc );
+ $sent = $this->emailNotification->notifyOnPageChange( $rc );
static::assertFalse( $sent );
// Reset notification timestamp, simulating that Bob visited the page.
@@ -60,7 +61,7 @@ class EmailNotificationTest extends MediaWikiIntegrationTestCase {
$store->addWatch( $bob, $title, '20060123000000' );
// Alice edits again, email should not be sent.
- $sent = $this->emailNotification->notifyOnPageChange( $alice, $title, $rc );
+ $sent = $this->emailNotification->notifyOnPageChange( $rc );
static::assertFalse( $sent );
}
}