Esempio n. 1
0
 /**
  * @see EntityDiff::isEmpty
  *
  * @return bool
  */
 public function isEmpty()
 {
     return parent::isEmpty() && $this->getSiteLinkDiff()->isEmpty();
 }
 /**
  * Generates and returns an HTML visualization of the provided EntityDiff.
  *
  * @since 0.4
  *
  * @param EntityDiff $diff
  *
  * @return string
  */
 protected function visualizeEntityDiff(EntityDiff $diff)
 {
     if ($diff->isEmpty()) {
         return '';
     }
     $html = '';
     $termDiffVisualizer = new DiffView(array(), new Diff(array($this->context->getLanguage()->getMessage('wikibase-diffview-label') => $diff->getLabelsDiff(), $this->context->getLanguage()->getMessage('wikibase-diffview-alias') => $diff->getAliasesDiff(), $this->context->getLanguage()->getMessage('wikibase-diffview-description') => $diff->getDescriptionsDiff()), true), $this->siteStore, $this->entityIdFormatter, $this->context);
     $html .= $termDiffVisualizer->getHtml();
     foreach ($diff->getClaimsDiff() as $claimDiffOp) {
         $html .= $this->getClaimDiffHtml($claimDiffOp);
     }
     // FIXME: this does not belong here as it is specific to items
     if ($diff instanceof ItemDiff) {
         $linkDiffVisualizer = new DiffView(array(), new Diff(array($this->context->getLanguage()->getMessage('wikibase-diffview-link') => $diff->getSiteLinkDiff()), true), $this->siteStore, $this->entityIdFormatter, $this->context);
         $html .= $linkDiffVisualizer->getHtml();
     }
     return $html;
 }
Esempio n. 3
0
 /**
  * @dataProvider isEmptyProvider
  * @param Diff[] $diffOps
  * @param bool $isEmpty
  */
 public function testIsEmpty(array $diffOps, $isEmpty)
 {
     $diff = new EntityDiff($diffOps);
     $this->assertEquals($isEmpty, $diff->isEmpty());
 }