Exemple #1
0
 /**
  * @deprecated since 0.8, use getSiteLinkList()->hasLinkWithSiteId() instead.
  * @since 0.4
  *
  * @param string $siteId
  *
  * @return bool
  */
 public function hasLinkToSite($siteId)
 {
     return $this->siteLinks->hasLinkWithSiteId($siteId);
 }
 /**
  * @param SiteLinkList $siteLinks
  * @param string &$action
  * @param array &$commentArgs
  *
  * @return ItemId[]
  */
 private function applyBadges(SiteLinkList $siteLinks, &$action, array &$commentArgs)
 {
     // If badges are not set in the change make sure they remain intact
     if ($this->badges === null) {
         return $siteLinks->hasLinkWithSiteId($this->siteId) ? $siteLinks->getBySiteId($this->siteId)->getBadges() : array();
     }
     if ($this->badgesAreEmptyAndUnchanged($siteLinks)) {
         return array();
     }
     $action .= $this->pageName === null ? '-badges' : '-both';
     $commentArgs[] = $this->badges;
     return $this->badges;
 }
 public function testGivenKnownId_removeSiteWithIdRemovesIt()
 {
     $list = new SiteLinkList(array(new SiteLink('foo', 'spam'), new SiteLink('bar', 'hax')));
     $list->removeLinkWithSiteId('foo');
     $this->assertFalse($list->hasLinkWithSiteId('foo'));
     $this->assertTrue($list->hasLinkWithSiteId('bar'));
 }