5
1
Fork 0
mirror of https://github.com/Anvilcraft/jensmemes synced 2024-11-12 13:01:30 +01:00
jensmemes/website/api/tinify-php-master/test/TinifyResultTest.php
2020-07-21 23:07:16 +02:00

35 lines
1.3 KiB
PHP

<?php
use Tinify\CurlMock;
class TinifyResultTest extends TestCase {
public function testWithMetaAndDataWidthShouldReturnImageWidth() {
$result = new Tinify\Result(array("image-width" => "100"), "image data");
$this->assertSame(100, $result->width());
}
public function testWithMetaAndDataHeightShouldReturnImageHeight() {
$result = new Tinify\Result(array("image-height" => "60"), "image data");
$this->assertSame(60, $result->height());
}
public function testWithMetaAndDataLocationShouldReturnNull() {
$result = new Tinify\ResultMeta(array(), "image data");
$this->assertSame(null, $result->location());
}
public function testWithMetaAndDataSizeShouldReturnContentLength() {
$result = new Tinify\Result(array("content-length" => "450"), "image data");
$this->assertSame(450, $result->size());
}
public function testWithMetaAndDataContentTypeShouldReturnMimeType() {
$result = new Tinify\Result(array("content-type" => "image/png"), "image data");
$this->assertSame("image/png", $result->contentType());
}
public function testWithMetaAndDataToBufferShouldReturnImageData() {
$result = new Tinify\Result(array(), "image data");
$this->assertSame("image data", $result->toBuffer());
}
}