Ejemplo n.º 1
0
 public function testSetWhenUsesZendDateObject()
 {
     $entry = new Writer\Deleted();
     $entry->setWhen(new Date\Date('1234567890', Date\Date::TIMESTAMP));
     $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP);
     $this->assertTrue($myDate->equals($entry->getWhen()));
 }
Ejemplo n.º 2
0
 public function testSetLastBuildDateUsesZendDateObject()
 {
     $writer = new Writer\Feed();
     $writer->setLastBuildDate(new Date\Date('1234567890', Date\Date::TIMESTAMP));
     $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP);
     $this->assertTrue($myDate->equals($writer->getLastBuildDate()));
 }
Ejemplo n.º 3
0
 /**
  * Get modification date (Unencoded Text)
  * @group ZFR002
  */
 public function testGetsDateModifiedFromAtom10()
 {
     $entry = Reader\Reader::importString(file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml'));
     $edate = new Date\Date();
     $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601);
     $this->assertTrue($edate->equals($entry->getDateModified()));
 }
Ejemplo n.º 4
0
 /**
  * @issue ZF-7908
  */
 public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat()
 {
     $feed = Reader\Reader::importString(file_get_contents($this->_feedSamplePath . '/datemodified/plain/rss20-zf-7908.xml'));
     $entry = $feed->current();
     //$this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ'));
     $edate = new Date\Date();
     $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Date\Date::RSS);
     $this->assertTrue($edate->equals($entry->getDateModified()));
 }
Ejemplo n.º 5
0
 /**
  * @ZF-9891
  */
 public function testComparingDatesWithoutOption()
 {
     $date = new Date(strtotime('Sat, 07 Mar 2009 08:03:50 +0000'));
     $date2 = new Date();
     $date2->set('Sat, 07 Mar 2009 08:03:50 +0000', Date::RFC_2822);
     $this->assertTrue($date2->equals($date));
 }
Ejemplo n.º 6
0
 /**
  * test looseBehaviour
  */
 public function testLoose()
 {
     $date = new Date(0, 'de_DE');
     try {
         $date->set(null, Date::YEAR);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     $date->set(10, 'de_DE');
     $this->assertEquals(10, $date->getTimestamp());
     try {
         $date->add(null, Date::YEAR);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     $date->add(10, 'de_DE');
     $this->assertEquals(20, $date->getTimestamp());
     try {
         $date->sub(null, Date::YEAR);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     $date->sub(10, 'de_DE');
     $this->assertEquals(10, $date->getTimestamp());
     try {
         $date->compare(null, Date::YEAR);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->equals(null, Date::YEAR);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->isEarlier(null, Date::YEAR);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->isLater(null, Date::YEAR);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setTime(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addTime(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subTime(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareTime(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setDate(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addDate(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subDate(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareDate(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setIso(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addIso(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subIso(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareIso(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setArpa(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addArpa(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subArpa(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareArpa(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setMonth(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addMonth(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subMonth(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareMonth(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setDay(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addDay(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subDay(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareDay(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setWeekday(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addWeekday(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subWeekday(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareWeekday(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setDayOfYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addDayOfYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subDayOfYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareDayOfYear(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setHour(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addHour(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subHour(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareHour(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setMinute(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addMinute(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subMinute(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareMinute(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setSecond(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addSecond(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subSecond(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareSecond(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->setWeek(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->addWeek(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->subWeek(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
     try {
         $date->compareWeek(null);
         $this->fail();
     } catch (\Zend\Date\Exception $e) {
         // success
     }
 }