コード例 #1
0
    /**
     * testRender method
     */
    public function testRender()
    {
        $item = new JFeedItem(array('title' => 'Joomla!', 'link' => 'http://www.joomla.org', 'description' => 'Joomla main site', 'author' => 'Joomla', 'authorEmail' => '*****@*****.**', 'category' => 'CMS', 'comments' => 'No comment', 'guid' => 'joomla', 'date' => 'Mon, 20 Jan 03 18:05:41 +0400', 'source' => 'http://www.joomla.org'));
        $this->object->addItem($item);
        $this->assertThat(preg_replace('#\\t\\t<lastBuildDate>[^<]*</lastBuildDate>\\n#', '', $this->object->render()), $this->equalTo('<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Joomla! 1.6 - Open Source Content Management" -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title></title>
		<description></description>
		<link>http://localhost</link>
		<generator>Joomla! 1.6 - Open Source Content Management</generator>
		<atom:link rel="self" type="application/rss+xml" href="http://localhost/index.php?format=feed&amp;type=rss"/>
		<language>en-gb</language>
		<item>
			<title>Joomla!</title>
			<link>http://www.joomla.org</link>
			<guid isPermaLink="false">joomla</guid>
			<description><![CDATA[Joomla main site]]></description>
			<author>joomla@joomla.org (Joomla)</author>
			<category>CMS</category>
			<comments>No comment</comments>
			<pubDate>Mon, 20 Jan 2003 14:05:41 +0000</pubDate>
		</item>
	</channel>
</rss>
'), 'Line:' . __LINE__ . ' The feed does not generate properly.');
    }