예제 #1
0
 public function testSearchAttributeValue()
 {
     $xml = new \SimpleXmlElement('<enclosure />');
     $xml->addAttribute('href', 'http://localhost/');
     $xml->addAttribute('type', 'audio/mpeg');
     $xml->addAttribute('length', '456');
     $this->assertNull($this->object->searchAttributeValue($xml, array('foo')));
     $this->assertEquals('http://localhost/', $this->object->searchAttributeValue($xml, array('url', 'href')));
 }
 /**
  *
  */
 public function testHtmlSummary()
 {
     $file = dirname(__FILE__) . '/../../../Resources/sample-atom-summary.xml';
     $xmlBody = new \SimpleXMLElement(file_get_contents($file));
     $date = \DateTime::createFromFormat('Y-m-d', '2002-10-10');
     $filters = array(new ModifiedSince($date));
     $feed = $this->object->parse($xmlBody, new FeedContent(), $filters);
     $this->assertInstanceOf("Debril\\RssAtomBundle\\Protocol\\FeedInInterface", $feed);
     $item = current($feed->getItems());
     $expected = '<div xmlns="http://www.w3.org/1999/xhtml"><p>sample text</p></div>';
     $this->assertEquals($expected, $item->getSummary());
 }