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()); }
/** * @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; }