/**
  * @covers \Netgen\TagsBundle\Core\Persistence\Legacy\Tags\Handler::loadSynonyms
  */
 public function testLoadSynonyms()
 {
     $handler = $this->getTagsHandler();
     $this->gateway->expects($this->once())->method('getSynonyms')->with(42)->will($this->returnValue(array(array('eztags_id' => 43), array('eztags_id' => 44), array('eztags_id' => 45))));
     $this->mapper->expects($this->once())->method('extractTagListFromRows')->with(array(array('eztags_id' => 43), array('eztags_id' => 44), array('eztags_id' => 45)))->will($this->returnValue(array(new Tag(array('id' => 43)), new Tag(array('id' => 44)), new Tag(array('id' => 45)))));
     $tags = $handler->loadSynonyms(42);
     $this->assertCount(3, $tags);
     foreach ($tags as $tag) {
         $this->assertInstanceOf('Netgen\\TagsBundle\\SPI\\Persistence\\Tags\\Tag', $tag);
     }
 }
Exemple #2
0
 /**
  * Loads the synonyms of a tag identified by $tagId.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified tag is not found
  *
  * @param mixed $tagId
  * @param int $offset The start offset for paging
  * @param int $limit The number of tags returned. If $limit = -1 all synonyms starting at $offset are returned
  * @param string[] $translations
  * @param bool $useAlwaysAvailable
  *
  * @return \Netgen\TagsBundle\SPI\Persistence\Tags\Tag[]
  */
 public function loadSynonyms($tagId, $offset = 0, $limit = -1, array $translations = null, $useAlwaysAvailable = true)
 {
     $tags = $this->gateway->getSynonyms($tagId, $offset, $limit, $translations, $useAlwaysAvailable);
     return $this->mapper->extractTagListFromRows($tags);
 }