Exemplo n.º 1
0
 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());
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 /**
  * Delete published entry
  *
  * @param Newscoop\Entity\Ingest\Feed\Entry $entry
  * @return void
  */
 private function deletePublished(Entry $entry)
 {
     if ($entry->isPublished()) {
         $this->publisher->delete($entry);
     }
 }
Exemplo n.º 5
0
 /**
  * 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);
 }
Exemplo n.º 6
0
 /**
  * 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());
 }
Exemplo n.º 7
0
 /**
  * Get entry
  *
  * @param array $expects
  * @return Newscoop\Entity\Ingest\Feed\Entry
  */
 private function getEntry(array $expects)
 {
     return Entry::create($this->getParser($expects));
 }