public function testGivenUntrimmedPageName_generateDoesNotTrim()
 {
     $item = new Item();
     $item->getFingerprint()->setLabel('en', ' untrimmed label ');
     $item->getSiteLinkList()->addNewSiteLink('enwiki', ' untrimmed pageName ');
     $generator = new ItemSearchTextGenerator();
     $text = $generator->generate($item);
     $this->assertSame(" untrimmed label \n untrimmed pageName ", $text);
 }
Exemplo n.º 2
0
 /**
  * @see EntityContent::getTextForSearchIndex()
  */
 public function getTextForSearchIndex()
 {
     if ($this->isRedirect()) {
         return '';
     }
     // TODO: Refactor ItemSearchTextGenerator to share an interface with
     // FingerprintSearchTextGenerator, so we don't have to re-implement getTextForSearchIndex() here.
     $searchTextGenerator = new ItemSearchTextGenerator();
     $text = $searchTextGenerator->generate($this->getItem());
     if (!Hooks::run('WikibaseTextForSearchIndex', array($this, &$text))) {
         return '';
     }
     return $text;
 }