/**
  * @dataProvider provideToString
  */
 public function testToString($changes, $regex)
 {
     $job = ChangeNotificationJob::newFromChanges($changes);
     // toString used to fail on some platforms if a job contained a non-primitive parameter.
     $s = $job->toString();
     $this->assertRegExp($regex, $s);
 }
コード例 #2
0
 /**
  * @see ChangeNotificationSender::sendNotification
  *
  * @param string   $siteID:  The client wiki's global site identifier, as used by sitelinks.
  * @param Change[] $changes: The list of changes to post to the wiki.
  */
 public function sendNotification($siteID, array $changes)
 {
     if (empty($changes)) {
         return;
         // nothing to do
     }
     if (isset($this->wikiDBNames[$siteID])) {
         $wikiDB = $this->wikiDBNames[$siteID];
     } else {
         $wikiDB = $siteID;
     }
     $job = ChangeNotificationJob::newFromChanges($changes, $this->repoDB);
     // @todo: inject JobQueueGroup
     $qgroup = JobQueueGroup::singleton($wikiDB);
     $qgroup->push($job);
     wfDebugLog(__METHOD__, "Posted notification job for site {$siteID} with " . count($changes) . " changes to {$wikiDB}.");
 }