rotated));
$html = $display->getDetailHtml(500, 500);
// rotated 30x20 fit into 500x500 bbox -> 500x333 (matches MediaFileTest)
$this->assertStringContainsString('width="500"', $html);
$this->assertStringContainsString('height="333"', $html);
}
public function testGetDetailHtmlStructure()
{
$display = new Display(new MediaFile($this->rotated));
$html = $display->getDetailHtml();
$this->assertStringContainsString('
', $html);
$this->assertStringContainsString('target="_blank"', $html);
$this->assertStringContainsString('fit=1', $html);
$this->assertStringContainsString('
![]()
assertSame('', $display->getDetailHtml());
}
public function testGetDetailHtmlUsesRevParamWhenRevIsSet()
{
$rev = 1700000000;
$atticPath = mediaFN($this->rotated, $rev);
if (!is_dir(dirname($atticPath))) mkdir(dirname($atticPath), 0777, true);
copy(mediaFN($this->rotated), $atticPath);
try {
$html = (new Display(new MediaFile($this->rotated, $rev)))->getDetailHtml();
$this->assertMatchesRegularExpression('/[?&][^f]*?rev=' . $rev . '/', $html);
$this->assertDoesNotMatchRegularExpression('/[?&](?:amp;)*t=\d/', $html);
} finally {
unlink($atticPath);
}
}
public function testGetDetailHtmlUsesTimestampWhenNoRev()
{
$html = (new Display(new MediaFile($this->rotated)))->getDetailHtml();
$this->assertMatchesRegularExpression('/[?&](?:amp;)*t=\d/', $html);
$this->assertStringNotContainsString('rev=', $html);
}
}