aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/filerepo/file
diff options
context:
space:
mode:
authorMáté Szabó <mszabo@wikimedia.org>2025-04-04 11:47:44 +0200
committerMáté Szabó <mszabo@wikimedia.org>2025-04-04 15:46:44 +0200
commit394a18083405108b9ad2d48bd4cb5225333bd19a (patch)
tree49a3d89e60eb21ab55916536e744b1b451dd96f0 /tests/phpunit/includes/filerepo/file
parent95485727e1d333be0995ff8b48b5f6e5593918b2 (diff)
downloadmediawikicore-394a18083405108b9ad2d48bd4cb5225333bd19a.tar.gz
mediawikicore-394a18083405108b9ad2d48bd4cb5225333bd19a.zip
storage: Assert CategoryMembershipChangeJob via trait
Why: - As suggested on I14944639e00407f59380c8787fd2810c7d24a5c9, ChangeTrackingUpdateSpyTrait is a better place to assert on operations performed by ChangeTrackingEventIngress than DerivedPageDataUpdaterTest. What: - Add an expected number of enqueued CategoryMembershipChangeJobs to ChangeTrackingUpdateSpyTrait. - Update tests using the trait to specify the expected number of jobs. - Clear hooks in relevant tests to avoid test failures when extensions are loaded that attempt to call methods on the mocks set by ChangeTrackingUpdateSpyTrait. These tests currently fail if e.g. PageTriage, Echo or EventBus are loaded. Bug: T390636 Change-Id: I6fe6cb87cd5a16b1ed39e0998c49713704633d71
Diffstat (limited to 'tests/phpunit/includes/filerepo/file')
-rw-r--r--tests/phpunit/includes/filerepo/file/LocalFileTest.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/phpunit/includes/filerepo/file/LocalFileTest.php b/tests/phpunit/includes/filerepo/file/LocalFileTest.php
index 5a9b0a9ae327..8bba9ec1dfd2 100644
--- a/tests/phpunit/includes/filerepo/file/LocalFileTest.php
+++ b/tests/phpunit/includes/filerepo/file/LocalFileTest.php
@@ -896,8 +896,14 @@ class LocalFileTest extends MediaWikiIntegrationTestCase {
* @covers \LocalFile
*/
public function testUpload_updatePropagation() {
+ // Clear some extension hook handlers that may interfere with mock object expectations.
+ $this->clearHooks( [
+ 'PageSaveComplete',
+ 'RevisionRecordInserted',
+ ] );
+
// Expect two non-edit recent changes entries but only one edit count.
- $this->expectChangeTrackingUpdates( 0, 2, 1, 0 );
+ $this->expectChangeTrackingUpdates( 0, 2, 1, 0, 1 );
// Expect only one search update, the re-upload doesn't change the page.
$this->expectSearchUpdates( 1 );