1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 09:10:21 +02:00

Optimize tests

This commit is contained in:
Oliver Vogel
2024-12-06 17:32:55 +01:00
parent 69daa96f66
commit b9a16d4df6
120 changed files with 292 additions and 185 deletions

View File

@@ -4,14 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\Gd\Encoders\AvifEncoder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Encoders\AvifEncoder;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Encoders\AvifEncoder::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Encoders\AvifEncoder::class)]
#[CoversClass(AvifEncoder::class)]
final class AvifEncoderTest extends GdTestCase
{
public function testEncode(): void

View File

@@ -4,14 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\Gd\Encoders\BmpEncoder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Encoders\BmpEncoder;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Encoders\BmpEncoder::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Encoders\BmpEncoder::class)]
#[CoversClass(BmpEncoder::class)]
final class BmpEncoderTest extends GdTestCase
{
public function testEncode(): void

View File

@@ -5,14 +5,13 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Encoders;
use Intervention\Gif\Decoder;
use Intervention\Image\Drivers\Gd\Encoders\GifEncoder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Encoders\GifEncoder;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Encoders\GifEncoder::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Encoders\GifEncoder::class)]
#[CoversClass(GifEncoder::class)]
final class GifEncoderTest extends GdTestCase
{
public function testEncode(): void

View File

@@ -4,15 +4,15 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\Drivers\Gd\Encoders\JpegEncoder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Encoders\JpegEncoder;
use Intervention\Image\Tests\GdTestCase;
use Intervention\Image\Tests\Traits\CanDetectProgressiveJpeg;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Encoders\JpegEncoder::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Encoders\JpegEncoder::class)]
#[CoversClass(JpegEncoder::class)]
final class JpegEncoderTest extends GdTestCase
{
use CanDetectProgressiveJpeg;
@@ -21,6 +21,7 @@ final class JpegEncoderTest extends GdTestCase
{
$image = $this->createTestImage(3, 2);
$encoder = new JpegEncoder(75);
$encoder->setDriver(new Driver());
$result = $encoder->encode($image);
$this->assertMediaType('image/jpeg', $result);
$this->assertEquals('image/jpeg', $result->mimetype());
@@ -30,6 +31,7 @@ final class JpegEncoderTest extends GdTestCase
{
$image = $this->createTestImage(3, 2);
$encoder = new JpegEncoder(progressive: true);
$encoder->setDriver(new Driver());
$result = $encoder->encode($image);
$this->assertMediaType('image/jpeg', $result);
$this->assertEquals('image/jpeg', $result->mimetype());

View File

@@ -5,17 +5,16 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Encoders;
use Generator;
use Intervention\Image\Drivers\Gd\Encoders\PngEncoder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Encoders\PngEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Tests\GdTestCase;
use Intervention\Image\Tests\Traits\CanInspectPngFormat;
use PHPUnit\Framework\Attributes\DataProvider;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Encoders\PngEncoder::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Encoders\PngEncoder::class)]
#[CoversClass(PngEncoder::class)]
final class PngEncoderTest extends GdTestCase
{
use CanInspectPngFormat;

View File

@@ -4,14 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\Gd\Encoders\WebpEncoder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Encoders\WebpEncoder;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Encoders\WebpEncoder::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Encoders\WebpEncoder::class)]
#[CoversClass(WebpEncoder::class)]
final class WebpEncoderTest extends GdTestCase
{
public function testEncode(): void