$item2Params = array('title' => 'foobaritem', 'pubDate' => '123456', 'authorEmail' => '*****@*****.**', 'link' => 'http://www.example.com/item2');
$image_params = array('title' => 'symfony project', 'link' => 'http://www.symfony-project.org', 'favicon' => 'http://www.symfony-project.org/favicon.ico', 'image' => 'http://www.symfony-project.org/images/symfony_logo.gif', 'faviconX' => '16', 'faviconY' => '16', 'imageX' => '176', 'imageY' => '37');
$feed = new sfRssFeed();
$feed->initialize($feedParams);
$feedItem = new sfFeedItem();
$feedItem->initialize($itemParams);
$feed->addItem($feedItem);
$feedItem2 = new sfFeedItem();
$feedItem2->initialize($item2Params);
$feed->addItem($feedItem2);
$feedImage = new sfFeedImage();
$feedImage->initialize($image_params);
$feed->setImage($feedImage);
$t = new lime_test(62, new lime_output_color());
$t->diag('toXML() - generated feed');
$feedString = $feed->toXml();
$feedXml = simplexml_load_string($feedString);
$t->is($feedXml->getName(), 'rss', '<rss> is the main tag');
preg_match('/^<\\?xml\\s*version="1\\.0"\\s*encoding="(.*?)".*?\\?>$/mi', $feedString, $matches);
$t->is($matches[1], $feed->getEncoding(), 'The encoding is set with the proper feed encoding');
$t->is((string) $feedXml->channel[0]->title, $feedParams['title'], '<title> contains the feed title');
$t->is((string) $feedXml->channel[0]->link, $feedParams['link'], '<link> contains the feed link');
$t->is((string) $feedXml->channel[0]->description, $feedParams['description'], '<description> contains the feed description');
$t->is((string) $feedXml->channel[0]->language, $feedParams['language'], '<language> contains the feed language');
$t->is((string) $feedXml->channel[0]->managingEditor, $feedParams['authorEmail'] . ' (' . $feedParams['authorName'] . ')', '<managingEditor> contains the author email and name');
$t->is((string) $feedXml->channel[0]->pubDate, date(DATE_RFC822, $item2Params['pubDate']), '<pubDate> contains the latest publication date of all feed items');
$t->is_deeply(array((string) $feedXml->channel[0]->category[0], (string) $feedXml->channel[0]->category[1]), $feedParams['categories'], '<category> contains the correct categories');
$t->is((string) $feedXml->channel[0]->image->url, $image_params['image'], '<image><url> contains the proper image');
$t->is((string) $feedXml->channel[0]->image->width, $image_params['imageX'], '<image><width> contains the proper image x');
$t->is((string) $feedXml->channel[0]->image->height, $image_params['imageY'], '<image><height> contains the proper image y');
$t->is((string) $feedXml->channel[0]->image->link, $image_params['link'], '<image><link> contains the proper image link');