/** * Test if related links can be set * * @test * @return void */ public function relatedLinksCanBeSet() { $link = new Link(); $link->setTitle('fo'); $related = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $related->attach($link); $this->newsDomainModelInstance->setRelatedLinks($related); $this->assertEquals($related, $this->newsDomainModelInstance->getRelatedLinks()); }
/** * Get an existing related link object * * @param \GeorgRinger\News\Domain\Model\News $news * @param string $uri * @return bool|Link */ protected function getRelatedLinkIfAlreadyExists(\GeorgRinger\News\Domain\Model\News $news, $uri) { $result = FALSE; $links = $news->getRelatedLinks(); if (!empty($links) && $links->count() !== 0) { foreach ($links as $link) { if ($link->getUri() === $uri) { $result = $link; break; } } } return $result; }