public function testUpdate() { $entry = Entry::create(new NewsMlParser(APPLICATION_PATH . NewsMlParserTest::NEWSML)); $updated = new NewsMlParser(APPLICATION_PATH . NewsMlParserTest::NEWSML_UPDATED); $entry->update($updated); $this->assertEquals($entry->getTitle(), $updated->getTitle()); $this->assertEquals($entry->getCreated(), $updated->getCreated()); $this->assertEquals($entry->getUpdated(), $updated->getUpdated()); $this->assertEquals($entry->getContent(), $updated->getContent()); $this->assertEquals($entry->getPriority(), $updated->getPriority()); $this->assertEquals($entry->getSummary(), $updated->getSummary()); $this->assertEquals($entry->getStatus(), $updated->getStatus()); $this->assertEquals($entry->getAuthors(), $updated->getAuthors()); }
/** * Get entry from parser with given methods * * @param array $methods * @return Newscoop\Entity\Ingest\Feed\Entry */ private function getEntry(array $methods) { $parser = $this->getMockBuilder('Newscoop\\Ingest\\Parser\\NewsMlParser')->disableOriginalConstructor()->getMock(); foreach ($methods as $method => $return) { $parser->expects($this->once())->method($method)->will($this->returnValue($return)); } return Entry::create($parser); }
public function update(\Newscoop\Ingest\Parser $parser) { $this->__load(); return parent::update($parser); }
/** * Delete published entry * * @param Newscoop\Entity\Ingest\Feed\Entry $entry * @return void */ private function deletePublished(Entry $entry) { if ($entry->isPublished()) { $this->publisher->delete($entry); } }
/** * Set entry images * * @param Newscoop\Entity\Ingest\Feed\Entry $entry * @param Newscoop\Ingest\Parser $parser */ private static function setImages(self $entry, Parser $parser) { $images = array(); $parserImages = $parser->getImages(); if (is_array($parserImages)) { foreach ($parserImages as $image) { $images[basename($image->getPath())] = $image->getTitle(); } } $entry->setAttribute('images', $images); }
/** * Get article for entry * * @param Newscoop\Entity\Ingest\Feed\Entry $entry * @return Article */ private function getArticle(Entry $entry) { return new \Article($this->getLanguage($entry->getLanguage()), $entry->getArticleNumber()); }
/** * Get entry * * @param array $expects * @return Newscoop\Entity\Ingest\Feed\Entry */ private function getEntry(array $expects) { return Entry::create($this->getParser($expects)); }