1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 17:19:50 +02:00

Change signature of internal methods

The following internal methods now return enum MediaType instead of
string.

Intervention\Image\AbstractDecoder::getMediaTypeByFilePath()
Intervention\Image\AbstractDecoder::getMediaTypeByBinary()
This commit is contained in:
Oliver Vogel
2024-06-26 17:13:30 +02:00
parent c199536eac
commit bbf0f9f821
4 changed files with 31 additions and 26 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Decoders;
use Intervention\Image\Drivers\Gd\Decoders\AbstractDecoder;
use Intervention\Image\MediaType;
use Intervention\Image\Tests\BaseTestCase;
use Mockery;
@@ -13,12 +14,18 @@ final class AbstractDecoderTest extends BaseTestCase
public function testGetMediaTypeFromFilePath(): void
{
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
$this->assertEquals('image/jpeg', $decoder->getMediaTypeByFilePath($this->getTestResourcePath('test.jpg')));
$this->assertEquals(
MediaType::IMAGE_JPEG,
$decoder->getMediaTypeByFilePath($this->getTestResourcePath('test.jpg'))
);
}
public function testGetMediaTypeFromFileBinary(): void
{
$decoder = Mockery::mock(AbstractDecoder::class)->makePartial();
$this->assertEquals('image/jpeg', $decoder->getMediaTypeByBinary($this->getTestResourceData('test.jpg')));
$this->assertEquals(
MediaType::IMAGE_JPEG,
$decoder->getMediaTypeByBinary($this->getTestResourceData('test.jpg')),
);
}
}