Feed XML; private const NO_ITEMS_FEED = << Index RSS Thu, 03 Oct 24 20:06:25 +0000 https://example.railgun.sh/articles This should accept HTML!]]> XML; private const ITEMS_FEED = << Index RSS Thu, 03 Oct 24 20:06:25 +0000 https://example.railgun.sh/articles This should accept HTML!]]> Article 1 Sat, 28 Sep 24 01:13:05 +0000 https://example.railgun.sh/articles/1 https://example.railgun.sh/articles/1 https://example.railgun.sh/articles/1#comments This is an article!

It has HTML and multiple lines and all that awesome stuff!!!!

Meaning it can also have sections

Technology is so cool...

]]>
flashwave https://example.railgun.sh/author/1
Article 2 Sun, 29 Sep 24 04:59:45 +0000 https://example.railgun.sh/articles/2 https://example.railgun.sh/articles/2 https://example.railgun.sh/articles/2#comments hidden author spooky

]]>
Article 3 without a description Mon, 30 Sep 24 08:46:25 +0000 https://example.railgun.sh/articles/3 https://example.railgun.sh/articles/3 https://example.railgun.sh/articles/3#comments Anonymous
XML; public function testFeedBuilder(): void { $feed = new FeedBuilder; $this->assertEquals(self::BLANK_FEED, $feed->toXmlString()); $feed->setTitle('Index RSS'); $feed->setDescription('This should accept HTML!'); $feed->setUpdatedAt(1727985985); $feed->setContentUrl('https://example.railgun.sh/articles'); $feed->setFeedUrl('https://example.railgun.sh/feed.xml'); $this->assertEquals(self::NO_ITEMS_FEED, $feed->toXmlString()); $feed->createEntry(function($item) { $item->setTitle('Article 1'); $item->setDescription(<<This is an article!

It has HTML and multiple lines and all that awesome stuff!!!!

Meaning it can also have sections

Technology is so cool...

HTML); $item->setCreatedAt(1727485985); $item->setContentUrl('https://example.railgun.sh/articles/1'); $item->setCommentsUrl('https://example.railgun.sh/articles/1#comments'); $item->setAuthorName('flashwave'); $item->setAuthorUrl('https://example.railgun.sh/author/1'); }); $feed->createEntry(function($item) { $item->setTitle('Article 2'); $item->setDescription(<<hidden author spooky

HTML); $item->setCreatedAt(1727585985); $item->setContentUrl('https://example.railgun.sh/articles/2'); $item->setCommentsUrl('https://example.railgun.sh/articles/2#comments'); }); $feed->createEntry(function($item) { $item->setTitle('Article 3 without a description'); $item->setCreatedAt(1727685985); $item->setContentUrl('https://example.railgun.sh/articles/3'); $item->setCommentsUrl('https://example.railgun.sh/articles/3#comments'); $item->setAuthorName('Anonymous'); }); $this->assertEquals(self::ITEMS_FEED, $feed->toXmlString()); } }