Пример #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());
 }
Пример #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);
 }
Пример #3
0
 /**
  * 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;
 }
Пример #4
0
 /**
  * Get entry
  *
  * @param array $expects
  * @return Newscoop\Entity\Ingest\Feed\Entry
  */
 private function getEntry(array $expects)
 {
     return Entry::create($this->getParser($expects));
 }