public function testFindBy() { $feed = new Feed('title'); $feed->addEntry(new Entry('title', 'content')); $feed->addEntry(new Entry('title2', 'content')); $this->em->persist($feed); $this->em->flush(); $this->em->clear(); $entries = $this->service->findBy(array('feed' => $feed->getId()), array('updated' => 'desc'), 10, 0); $this->assertEquals(2, count($entries)); }
/** * Get previous version of entry * * @param Newscoop\Ingest\Parser $parser * @param Newscoop\Entity\Ingest\Feed $feed * @return Newscoop\Entity\Ingest\Feed\Entry */ public function getPrevious(Parser $parser, Feed $feed) { $previous = array_shift($this->getEntryRepository()->findBy(array('date_id' => $parser->getDateId(), 'news_item_id' => $parser->getNewsItemId()))); if (empty($previous)) { $previous = Entry::create($parser); $feed->addEntry($previous); } return $previous; }
public function getEntries() { $this->__load(); return parent::getEntries(); }
/** * Test article authors */ private function checkAuthors($count, \Article $article, Feed $feed) { $authors = \ArticleAuthor::GetAuthorsByArticle($article->getArticleNumber(), $article->getLanguageId()); $this->assertEquals(1, count($authors), 'Authors count fails.'); $this->assertEquals($feed->getTitle(), $authors[0]->getName()); }