', $page);
$this->assertStringNotContainsString('title', $page);
}
public function testStoryHtmlIsPurified(): void {
$page = display_stories();
$this->assertStringContainsString('
One hundred
', $page);
$this->assertStringNotContainsString('onclick', $page);
$this->assertStringNotContainsString('alert', $page);
}
public function testDatesAreShownWithoutSecondsAndMarkedUp(): void {
$page = display_stories();
$datetime = date('Y-m-d\TH:i:sP', strtotime('2020-01-02 03:04:05'));
$this->assertStringContainsString('', $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, '