getMutableTestUser()->getUser(); // Create the page and make a couple of edits from different users $this->editPage( $title, 'AbuseFilter test for title variables', '', NS_MAIN, $user ); $mockContributors = [ 'X>Alice', 'X>Bob', 'X>Charlie' ]; foreach ( $mockContributors as $contributor ) { $this->editPage( $title, "page revision by $contributor", '', NS_MAIN, new UltimateAuthority( UserIdentityValue::newAnonymous( $contributor ) ) ); } $contributors = array_reverse( $mockContributors ); $contributors[] = $user->getName(); return $contributors; } public function testRecentContributors() { $varName = "page_recent_contributors"; $title = Title::makeTitle( NS_MAIN, "Page to test $varName" ); $expected = $this->computeRecentContributors( $title ); $computer = AbuseFilterServices::getLazyVariableComputer(); $var = new LazyLoadedVariable( 'load-recent-authors', [ 'title' => $title ] ); $forbidComputeCB = static function () { throw new LogicException( 'Not expected to be called' ); }; $actual = $computer->compute( $var, new VariableHolder(), $forbidComputeCB )->toNative(); $this->assertSame( $expected, $actual ); } }