Skip to content

Commit ae3620d

Browse files
dati18outdooracorn
andcommitted
Add comment explaining the hack to override the mwHostResolver property
Co-authored-by: Ollie <43674967+outdooracorn@users.noreply.github.com>
1 parent 46a715f commit ae3620d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/Jobs/PlatformStatsSummaryJobTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ public function testPrepareStatsTreatsSecondPrecisionTimestampAtThresholdAsActiv
298298
]);
299299

300300
$job = new PlatformStatsSummaryJob;
301+
302+
// This is a hack to override the `private` `PlatformStatsSummaryJob::mwHostResolver` property.
303+
// See https://www.php.net/manual/en/closure.call.php for more details on how this works.
304+
// TODO: figure out how to stub the `DatabaseManager` correctly and/or refactor the Job so that
305+
// we can more easily inject dependencies in the tests.
301306
(function ($resolver): void {
302307
$this->mwHostResolver = $resolver;
303308
})->call($job, $this->mockMwHostResolver);

0 commit comments

Comments
 (0)