Add test for profileImageSrcSet

This commit is contained in:
hina 2020-01-29 03:41:14 +09:00
parent 9431cd5b5d
commit c9af8130f4
No known key found for this signature in database
GPG Key ID: B666B2A137443F76

View File

@ -54,4 +54,20 @@ class FormatterTest extends TestCase
$url = 'http://example.com/path/to?foo=bar&hoge=fuga#'; $url = 'http://example.com/path/to?foo=bar&hoge=fuga#';
$this->assertEquals('http://example.com/path/to?foo=bar&hoge=fuga', $formatter->normalizeUrl($url)); $this->assertEquals('http://example.com/path/to?foo=bar&hoge=fuga', $formatter->normalizeUrl($url));
} }
public function testProfileImageSrcSet()
{
$formatter = new Formatter();
$profileImageProvider = new class() {
public function getProfileImageUrl(int $size)
{
return "https://example.com/$size.png";
}
};
$this->assertSame(
'https://example.com/128.png 1x,https://example.com/256.png 2x',
$formatter->profileImageSrcSet($profileImageProvider, 128, 2)
);
}
} }