コード例 #1
0
 public function testValueObject()
 {
     $entityId = new ItemId('Q1');
     $revisionData = new RevisionData('', '', '', null, '<SITE>', array());
     $instance = new ExternalChange($entityId, $revisionData, '<TYPE>');
     $this->assertSame($entityId, $instance->getEntityId());
     $this->assertSame($revisionData, $instance->getRev());
     $this->assertSame('<TYPE>', $instance->getChangeType());
     $this->assertSame('<SITE>', $instance->getSiteId());
 }
 private function assertExternalChangeEquals(ExternalChange $expected, ExternalChange $actual, $message = '')
 {
     if ($message !== '') {
         $message .= "\n";
     }
     $this->assertEquals($expected->getChangeType(), $actual->getChangeType(), $message . 'getChangeType');
     $this->assertEquals($expected->getEntityId(), $actual->getEntityId(), $message . 'getEntityId');
     $expectedRev = $expected->getRev();
     $actualRev = $actual->getRev();
     $this->assertEquals($expectedRev->getPageId(), $actualRev->getPageId(), $message . 'rev:getPageId');
     $this->assertEquals($expectedRev->getParentId(), $actualRev->getParentId(), $message . 'rev:getParentId');
     $this->assertEquals($expectedRev->getRevId(), $actualRev->getRevId(), $message . 'rev:getRevId');
     $this->assertEquals($expectedRev->getSiteId(), $actualRev->getSiteId(), $message . 'rev:getSiteId');
     $this->assertEquals($expectedRev->getTimestamp(), $actualRev->getTimestamp(), $message . 'rev:getTimestamp');
     $this->assertEquals($expectedRev->getUserName(), $actualRev->getUserName(), $message . 'rev:getUserName');
 }
コード例 #3
0
 /**
  * @param ExternalChange $externalChange
  * @param Title $title
  * @param int $count
  * @param string $flag - flag formatted by ChangesList::recentChangesFlags()
  *
  * @return string HTML
  */
 public function format(ExternalChange $externalChange, Title $title, $count, $flag)
 {
     $changeType = $externalChange->getChangeType();
     $rev = $externalChange->getRev();
     $entityId = $externalChange->getEntityId();
     $line = $changeType === 'restore' || $changeType === 'remove' ? $this->formatDeletionLogLink() : $this->formatDiffHist($entityId, $rev, $count);
     $line .= $this->changeSeparator();
     $line .= $flag . ' ';
     $line .= Linker::link($title);
     if ($changeType !== 'remove') {
         $line .= $this->formatEntityLink($entityId);
     }
     $line .= $this->formatTimestamp($rev->getTimestamp());
     $line .= $this->formatUserLinks($rev->getUserName());
     $commentHtml = $rev->getCommentHtml();
     if ($commentHtml === null || $commentHtml === '') {
         $commentHtml = Linker::formatComment($rev->getComment(), $title, false, $externalChange->getSiteId());
     }
     $line .= $this->wrapCommentBlock($commentHtml);
     return $line;
 }