/** * @dataProvider needsTargetSpecificSummaryProvider */ public function testNeedsTargetSpecificSummary($expected, Diff $siteLinkDiff, Title $title) { $siteStore = new HashSiteStore(TestSites::getSites()); $commentCreator = new SiteLinkCommentCreator(Language::factory('qqx'), $siteStore, 'enwiki'); $res = $commentCreator->needsTargetSpecificSummary($siteLinkDiff, $title); $this->assertSame($expected, $res); }
/** * Get a title specific rc_comment, in case that is needed. Null otherwise. * * @param EntityChange $change * @param Title $target * * @return string|null */ private function buildTargetSpecificComment(EntityChange $change, Title $target) { if (!$change instanceof ItemChange) { // Not an ItemChange return null; } $siteLinkDiff = $change->getSiteLinkDiff(); if (!$this->siteLinkCommentCreator->needsTargetSpecificSummary($siteLinkDiff, $target)) { return null; } $fields = $change->getFields(); if (isset($fields['info']['changes'])) { $changesForComment = $fields['info']['changes']; } else { $changesForComment = array($change); } return $this->getEditCommentMulti($changesForComment, $target); }