/**
  * Hook runs after internal parsing
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/ContentAlterParserOutput
  *
  * @param Title $title
  * @param ParserOutput $parserOutput
  *
  * @return bool
  */
 public function doContentAlterParserOutput(Title $title, ParserOutput $parserOutput)
 {
     if (!$this->namespaceChecker->isWikibaseEnabled($title->getNamespace())) {
         // shorten out
         return true;
     }
     $useRepoLinks = $this->langLinkHandler->useRepoLinks($title, $parserOutput);
     if ($useRepoLinks) {
         // add links
         $this->langLinkHandler->addLinksFromRepository($title, $parserOutput);
     }
     $this->parserOutputDataUpdater->updateItemIdProperty($title, $parserOutput);
     $this->parserOutputDataUpdater->updateOtherProjectsLinksData($title, $parserOutput);
     $this->parserOutputDataUpdater->updateBadgesProperty($title, $parserOutput);
     if ($useRepoLinks || $this->alwaysSort) {
         $interwikiLinks = $parserOutput->getLanguageLinks();
         $sortedLinks = $this->interwikiSorter->sortLinks($interwikiLinks);
         $parserOutput->setLanguageLinks($sortedLinks);
     }
     return true;
 }
 public function testUpdateBadgesProperty_inconsistentSiteLinkLookupNoSuchEntity()
 {
     $parserOutput = new ParserOutput();
     $title = Title::newFromText('Foo sr');
     $siteLinkLookup = new MockRepository();
     foreach ($this->getItems() as $item) {
         $siteLinkLookup->putEntity($item);
     }
     $parserOutputDataUpdater = new ClientParserOutputDataUpdater($this->getOtherProjectsSidebarGeneratorFactory(array()), $siteLinkLookup, new MockRepository(), 'srwiki');
     // Suppress warnings as this is supposed to throw one.
     \MediaWiki\suppressWarnings();
     $parserOutputDataUpdater->updateBadgesProperty($title, $parserOutput);
     \MediaWiki\restoreWarnings();
     // Stuff didn't blow up
     $this->assertTrue(true);
 }