Пример #1
0
 /**
  * @dataProvider getDefaultFormats
  * @covers Debril\RssAtomBundle\Protocol\Parser::guessDateFormat
  */
 public function testGuessDateFormat($default)
 {
     $this->object->setdateFormats($default);
     $date = 'Mon, 06 Sep 2009 16:45:00 GMT';
     $format = $this->object->guessDateFormat($date);
     $this->assertEquals(\DateTime::RSS, $format);
 }
Пример #2
0
 /**
  * @covers Debril\RssAtomBundle\Protocol\Parser::convertToDateTime
  */
 public function testConvertToDateTime()
 {
     $string = '2003-12-13T18:30:02Z';
     $date = Parser::convertToDateTime($string, \DateTime::RFC3339);
     $this->assertInstanceOf('\\DateTime', $date);
     $this->assertEquals('13/12/2003', $date->format('d/m/Y'));
 }
Пример #3
0
 /**
  * Add a Parser.
  *
  * @param Parser $parser
  *
  * @return FeedReader
  */
 public function addParser(Parser $parser)
 {
     $parser->setFactory($this->factory);
     $this->parsers[] = $parser;
     return $this;
 }