Fixed RSS feed test for environments without base url set-up

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54899 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-05-21 23:51:17 +00:00
parent bd93c623fc
commit 01b34bdd59

View File

@ -7,13 +7,16 @@ class RSSFeedTest extends SapphireTest {
$list->push(new RSSFeedTest_ItemA()); $list->push(new RSSFeedTest_ItemA());
$list->push(new RSSFeedTest_ItemB()); $list->push(new RSSFeedTest_ItemB());
$list->push(new RSSFeedTest_ItemC()); $list->push(new RSSFeedTest_ItemC());
$origServer = $_SERVER;
$_SERVER['HTTP_HOST'] = 'www.example.org';
$_SERVER['SCRIPT_NAME'] = '/sapphire/main.php';
$rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description"); $rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description");
$content = $rssFeed->feedContent(); $content = $rssFeed->feedContent();
// Debug::message($content); // Debug::message($content);
$this->assertContains('<link>http://www.example.org/item-a/</link>', $content);
$this->assertContains('<link>' . Director::absoluteBaseURL() . 'item-a/</link>', $content);
$this->assertContains('<link>http://www.example.com/item-b.html</link>', $content); $this->assertContains('<link>http://www.example.com/item-b.html</link>', $content);
$this->assertContains('<link>http://www.example.com/item-c.html</link>', $content); $this->assertContains('<link>http://www.example.com/item-c.html</link>', $content);
@ -37,7 +40,8 @@ class RSSFeedTest extends SapphireTest {
$this->assertContains('<description>ItemA AltContent</description>', $content); $this->assertContains('<description>ItemA AltContent</description>', $content);
$this->assertContains('<description>ItemB AltContent</description>', $content); $this->assertContains('<description>ItemB AltContent</description>', $content);
$this->assertContains('<description>ItemC AltContent</description>', $content); $this->assertContains('<description>ItemC AltContent</description>', $content);
$_SERVER = $origServer;
} }
} }