Example #1
0
 public function testAddsAndOrdersEntriesByDateIfRequested()
 {
     $writer = new Writer\Feed();
     $entry = $writer->createEntry();
     $entry->setDateCreated(1234567890);
     $entry2 = $writer->createEntry();
     $entry2->setDateCreated(1230000000);
     $writer->addEntry($entry);
     $writer->addEntry($entry2);
     $writer->orderByDate();
     $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Date\Date::TIMESTAMP));
 }
Example #2
0
 /**
  * @covers Zend\Feed\Writer\Feed::removeEntry
  */
 public function testRemoveEntry()
 {
     $writer = new Writer\Feed();
     $entry = $writer->createEntry();
     $entry->setDateCreated(1234567890);
     $entry2 = $writer->createEntry();
     $entry2->setDateCreated(1230000000);
     $entry3 = $writer->createEntry();
     $entry3->setDateCreated(1239999999);
     $writer->addEntry($entry);
     $writer->addEntry($entry2);
     $writer->addEntry($entry3);
     $writer->orderByDate();
     $this->assertEquals('1234567890', $writer->getEntry(1)->getDateCreated()->getTimestamp());
     $writer->removeEntry(1);
     $writer->orderByDate();
     $this->assertEquals('1230000000', $writer->getEntry(1)->getDateCreated()->getTimestamp());
 }