Give the feed of an empty site the current date.

The feed passed NULL to strtotime() when there were no stories.
This commit is contained in:
tim
2026-09-26 15:27:51 +02:00
parent 8d6282348c
commit b68c2eb568
2 changed files with 15 additions and 2 deletions
+11
View File
@@ -42,6 +42,17 @@ class FeedAndImageTest extends PageTestCase {
$this->assertSame(date('D, d M Y H:i:s O', strtotime('2021-01-03 10:00:00')), (string)$xml->channel->lastBuildDate);
}
// Without stories, the feed dates are the time of the request
public function testTheFeedOfAnEmptySite(): void {
$this->setTables(array());
$xml = simplexml_load_string($this->get('/feed')['body']);
$this->assertNotFalse($xml);
$now = (string)$xml->channel->pubDate;
$this->assertSame($now, (string)$xml->channel->lastBuildDate);
$this->assertSame($now, (string)$xml->channel->item[0]->pubDate);
$this->assertCount(1, $xml->channel->item);
}
public function testAnImageIsServedWithItsRealType(): void {
$image = $this->get('/display?id=2');
$this->assertSame(200, $image['status']);