Пример #1
0
$t->is((string) $feedXml->entry[0]->link[1]['type'], $enclosureParams['mimeType'], '<entry><link ref="enclosure"> contains the proper item enclosure mimeType');
$t->diag('asXML() - generated feed');
$feedString = $feed->asXml();
$t->is(sfContext::getInstance()->getResponse()->getContentType(), 'application/atom+xml; charset=UTF-16', 'The response comes with the correct Content-Type');
$t->diag('fromXML() - generated feed');
$generatedFeed = new sfAtom1Feed();
$generatedFeed->fromXml($feedString);
$t->is($generatedFeed->getTitle(), $feed->getTitle(), 'The title property is properly set');
$t->is($generatedFeed->getLink(), $feed->getLink(), 'The link property is properly set');
$t->isnt($generatedFeed->getDescription(), $feed->getDescription(), 'The description property cannot be set from an Atom feed');
$t->is($generatedFeed->getLanguage(), $feed->getLanguage(), 'The language property is properly set');
$t->is($generatedFeed->getAuthorEmail(), $feed->getAuthorEmail(), 'The author email property is properly set');
$t->is($generatedFeed->getAuthorName(), $feed->getAuthorName(), 'The author name property is properly set');
$t->is($generatedFeed->getAuthorLink(), $feed->getAuthorLink(), 'The author link property is properly set');
$t->is($generatedFeed->getSubtitle(), $feed->getSubtitle(), 'The subtitle property is properly set');
$t->is($generatedFeed->getCategories(), $feed->getCategories(), 'The categories property is properly set');
$t->is($generatedFeed->getFeedUrl(), $feed->getFeedUrl(), 'The feedUrl property is properly set');
$t->is($generatedFeed->getEncoding(), $feed->getEncoding(), 'The encoding property is properly set');
$t->is($generatedFeed->getImage()->getFavicon(), $feed->getImage()->getFavicon(), 'The feed favicon property is properly set');
$t->is($generatedFeed->getImage()->getImage(), $feed->getImage()->getImage(), 'The feed logo property is properly set');
$t->is($generatedFeed->getLatestPostDate(), $feed->getLatestPostDate(), 'The latest post date is correct');
$t->diag('fromXML() - generated feed items');
$items = $generatedFeed->getItems();
$generatedItem = $items[0];
$t->is($generatedItem->getTitle(), $feedItem->getTitle(), 'The title property is properly set');
$t->is($generatedItem->getLink(), $feedItem->getLink(), 'The link property is properly set');
$t->is($generatedItem->getDescription(), $feedItem->getDescription(), 'The description property is properly set');
$t->is($generatedItem->getContent(), $feedItem->getContent(), 'The content property is properly set');
$t->is($generatedItem->getAuthorEmail(), $feedItem->getAuthorEmail(), 'The author email property is properly set');
$t->is($generatedItem->getAuthorName(), $feedItem->getAuthorName(), 'The author name property is properly set');
$t->is($generatedItem->getAuthorLink(), $feedItem->getAuthorLink(), 'The author link property is properly set');