Show no date for a story without one.
Such a story showed the date of the story before it, or caused a warning when it came first.
This commit is contained in:
@@ -46,6 +46,19 @@ class DisplayStoriesTest extends TestCase {
|
||||
$this->assertStringContainsString('<time datetime="' . $datetime . '">2020-01-02 03:04</time>', $page);
|
||||
}
|
||||
|
||||
// A story without a date shows no date, not the date of the story before it
|
||||
public function testAStoryWithoutADateShowsNone(): void {
|
||||
SiteData::install(array('xxx' => array(
|
||||
array('id' => 1, 'title' => 'Dated', 'date' => '2020-01-02 03:04:05'),
|
||||
array('id' => 2, 'title' => 'Undated', 'date' => NULL),
|
||||
)));
|
||||
$GLOBALS['num_stories'] = 5;
|
||||
$page = display_stories();
|
||||
$this->assertSame(1, substr_count($page, '<time '));
|
||||
$this->assertStringContainsString('<dd class="date"></dd>', $page);
|
||||
$this->assertStringContainsString('<dd class="date"></dd>', display_stories('2'));
|
||||
}
|
||||
|
||||
public function testHiddenStoriesAreLeftOutForVisitors(): void {
|
||||
$this->assertStringNotContainsString('Picture', display_stories());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user